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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user