From 7c6c290695cb8726e876ff4fb8413913f661fc0b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 3 Aug 2013 16:27:30 -0400 Subject: 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. --- src/time/timer_create.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/time') 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); } -- cgit v1.2.1