aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2015-10-17 12:07:04 +0200
committerFlorian Weimer <fweimer@redhat.com>2015-10-17 12:07:04 +0200
commit4e1665024a48da9c865e991aff03a5ad03c771aa (patch)
tree0780aa680fb6c59c39849f8a8ea7f11da93e2144
parent6782806d8f6664d87d17bb30f8ce4e0c7c931e17 (diff)
downloadglibc-4e1665024a48da9c865e991aff03a5ad03c771aa.zip
glibc-4e1665024a48da9c865e991aff03a5ad03c771aa.tar.gz
glibc-4e1665024a48da9c865e991aff03a5ad03c771aa.tar.bz2
sunrpc: Rewrite with explicit TLS access using __thread
-rw-r--r--ChangeLog9
-rw-r--r--sunrpc/rpc_thread.c22
2 files changed, 17 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index eeee6d6..222ae42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2015-10-17 Florian Weimer <fweimer@redhat.com>
+ sunrpc: Rewrite with explicit TLS access using __thread.
+ * sunrpc/rpc_thread.c (thread_rpc_vars): New TLS variable.
+ (__rpc_thread_destroy, rpc_thread_multi): Access thread_rpc_vars
+ directly.
+ (__rpc_thread_variables): Access thread_rpc_vars directly.
+ Eliminate redundant assignment of the tvp variable.
+
+2015-10-17 Florian Weimer <fweimer@redhat.com>
+
malloc: Rewrite with explicit TLS access using __thread.
* sysdeps/generic/malloc-machine.h (tsd_key_t, tsd_key_create)
(tsd_setspecific, tsd_getspecific): Remove.
diff --git a/sunrpc/rpc_thread.c b/sunrpc/rpc_thread.c
index 2b93db4..e5225c5 100644
--- a/sunrpc/rpc_thread.c
+++ b/sunrpc/rpc_thread.c
@@ -10,7 +10,8 @@
/* Variable used in non-threaded applications or for the first thread. */
static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem;
-__libc_tsd_define (, struct rpc_thread_variables *, RPC_VARS)
+static __thread struct rpc_thread_variables *thread_rpc_vars
+ attribute_tls_model_ie;
/*
* Task-variable destructor
@@ -18,8 +19,7 @@ __libc_tsd_define (, struct rpc_thread_variables *, RPC_VARS)
void __attribute__ ((section ("__libc_thread_freeres_fn")))
__rpc_thread_destroy (void)
{
- struct rpc_thread_variables *tvp
- = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
+ struct rpc_thread_variables *tvp = thread_rpc_vars;
if (tvp != NULL) {
__rpc_thread_svc_cleanup ();
@@ -34,7 +34,7 @@ __rpc_thread_destroy (void)
free (tvp->svc_pollfd_s);
if (tvp != &__libc_tsd_RPC_VARS_mem)
free (tvp);
- __libc_tsd_set (struct rpc_thread_variables *, RPC_VARS, NULL);
+ thread_rpc_vars = NULL;
}
}
#ifdef _LIBC_REENTRANT
@@ -49,8 +49,7 @@ text_set_element (__libc_subfreeres, __rpc_thread_destroy);
static void
rpc_thread_multi (void)
{
- __libc_tsd_set (struct rpc_thread_variables *, RPC_VARS,
- &__libc_tsd_RPC_VARS_mem);
+ thread_rpc_vars = &__libc_tsd_RPC_VARS_mem;
}
@@ -58,20 +57,15 @@ struct rpc_thread_variables *
__rpc_thread_variables (void)
{
__libc_once_define (static, once);
- struct rpc_thread_variables *tvp;
+ struct rpc_thread_variables *tvp = thread_rpc_vars;
- tvp = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
if (tvp == NULL) {
__libc_once (once, rpc_thread_multi);
- tvp = __libc_tsd_get (struct rpc_thread_variables *, RPC_VARS);
+ tvp = thread_rpc_vars;
if (tvp == NULL) {
tvp = calloc (1, sizeof *tvp);
if (tvp != NULL)
- __libc_tsd_set (struct rpc_thread_variables *,
- RPC_VARS, tvp);
- else
- tvp = __libc_tsd_get (struct rpc_thread_variables *,
- RPC_VARS);
+ thread_rpc_vars = tvp;
}
}
return tvp;