summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libc/inet/rpc/rpc_thread.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c
index 12b7f2216..f716444a3 100644
--- a/libc/inet/rpc/rpc_thread.c
+++ b/libc/inet/rpc/rpc_thread.c
@@ -11,13 +11,7 @@
/* Variable used in non-threaded applications or for the first thread. */
static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem;
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-static struct rpc_thread_variables *__libc_tsd_RPC_VARS =
- &__libc_tsd_RPC_VARS_mem;
-#else
-static struct rpc_thread_variables *__libc_tsd_RPC_VARS_data =
- &__libc_tsd_RPC_VARS_mem;
-#endif
+__libc_tsd_define (, RPC_VARS)
/*
* Task-variable destructor
@@ -25,7 +19,7 @@ static struct rpc_thread_variables *__libc_tsd_RPC_VARS_data =
void
__rpc_thread_destroy (void)
{
- struct rpc_thread_variables *tvp = __rpc_thread_variables();
+ struct rpc_thread_variables *tvp = __libc_tsd_get (RPC_VARS);
if (tvp != NULL && tvp != &__libc_tsd_RPC_VARS_mem) {
__rpc_thread_svc_cleanup ();
@@ -38,6 +32,7 @@ __rpc_thread_destroy (void)
free (tvp->authdes_cache_s);
free (tvp->authdes_lru_s);
free (tvp);
+ __libc_tsd_set (RPC_VARS, NULL);
}
}
@@ -66,11 +61,7 @@ __rpc_thread_variables (void)
if (tvp != NULL)
__libc_tsd_set (RPC_VARS, tvp);
else
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
tvp = __libc_tsd_RPC_VARS;
-#else
- tvp = __libc_tsd_RPC_VARS_data;
-#endif
}
}
return tvp;