All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Nazar <nazard@nazar.ca>
To: libtirpc-devel@lists.sourceforge.net
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 5/5] Use static object on main thread, instead of thread specific data.
Date: Wed, 22 Jul 2020 01:34:45 -0400	[thread overview]
Message-ID: <20200722053445.27987-6-nazard@nazar.ca> (raw)
In-Reply-To: <20200722053445.27987-1-nazard@nazar.ca>

Signed-off-by: Doug Nazar <nazard@nazar.ca>
---
 src/getnetconfig.c | 3 +++
 src/mt_misc.c      | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/getnetconfig.c b/src/getnetconfig.c
index cfd33c2..3a27367 100644
--- a/src/getnetconfig.c
+++ b/src/getnetconfig.c
@@ -136,6 +136,9 @@ __nc_error()
 	 * (including non-threaded programs), or if an allocation
 	 * fails.
 	 */
+	if (thr_main())
+		return (&nc_error);
+
 	if (nc_key == KEY_INITIALIZER) {
 		error = 0;
 		mutex_lock(&nc_lock);
diff --git a/src/mt_misc.c b/src/mt_misc.c
index 020b55d..79deaa3 100644
--- a/src/mt_misc.c
+++ b/src/mt_misc.c
@@ -112,6 +112,9 @@ __rpc_createerr()
 {
 	struct rpc_createerr *rce_addr;
 
+	if (thr_main())
+		return (&rpc_createerr);
+
 	mutex_lock(&tsd_lock);
 	if (rce_key == KEY_INITIALIZER)
 		thr_keycreate(&rce_key, free);
-- 
2.26.2


      parent reply	other threads:[~2020-07-22  5:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  5:34 [PATCH 0/5] libtirpc patches Doug Nazar
2020-07-22  5:34 ` [PATCH 1/5] svc_dg: Free xp_netid during destroy Doug Nazar
2020-07-22  5:34 ` [PATCH 2/5] svc: Batch allocations of pollfds Doug Nazar
2020-07-29 14:20   ` Steve Dickson
2020-07-22  5:34 ` [PATCH 3/5] Add destructor functions to cleanup static resources on exit Doug Nazar
2020-07-22  5:34 ` [PATCH 4/5] Add ability to detect if we're on the main thread Doug Nazar
2020-07-29 14:27   ` Steve Dickson
2020-07-22  5:34 ` Doug Nazar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200722053445.27987-6-nazard@nazar.ca \
    --to=nazard@nazar.ca \
    --cc=libtirpc-devel@lists.sourceforge.net \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.