summaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-03 16:27:30 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-03 16:27:30 -0400
commit7c6c290695cb8726e876ff4fb8413913f661fc0b (patch)
tree9bba80c02f293fcf759bd9b2fe0004f99ac96fae /src/time
parent7356c2554e33cf16768616e8e3ae4a4f5a5aac17 (diff)
downloadmusl-7c6c290695cb8726e876ff4fb8413913f661fc0b.tar.gz
add system for resetting TLS to initial values
this is needed for reused threads in the SIGEV_THREAD timer notification system, and could be reused elsewhere in the future if needed, though it should be refactored for such use. for static linking, __init_tls.c is simply modified to export the TLS info in a structure with external linkage, rather than using statics. this perhaps makes the code more clear, since the statics were poorly named for statics. the new __reset_tls.c is only linked if it is used. for dynamic linking, the code is in dynlink.c. sharing code with __copy_tls is not practical since __reset_tls must also re-zero thread-local bss.
Diffstat (limited to 'src/time')
-rw-r--r--src/time/timer_create.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/time/timer_create.c b/src/time/timer_create.c
index 2b4619d4..ee6a9c9d 100644
--- a/src/time/timer_create.c
+++ b/src/time/timer_create.c
@@ -19,6 +19,8 @@ static void dummy_1(pthread_t self)
}
weak_alias(dummy_1, __pthread_tsd_run_dtors);
+void __reset_tls();
+
static void cleanup_fromsig(void *p)
{
pthread_t self = __pthread_self();
@@ -28,6 +30,7 @@ static void cleanup_fromsig(void *p)
self->canceldisable = 0;
self->cancelasync = 0;
self->unblock_cancel = 0;
+ __reset_tls();
longjmp(p, 1);
}