From dac084a4c5f52bb3b121675320c47d3c3614174e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 27 Feb 2012 18:51:02 -0500 Subject: work around "signal loses thread pointer" issue with "approach 2" this was discussed on the mailing list and no consensus on the preferred solution was reached, so in anticipation of a release, i'm just committing a minimally-invasive solution that avoids the problem by ensuring that multi-threaded-capable programs will always have initialized the thread pointer before any signal handler can run. in the long term we may switch to initializing the thread pointer at program start time whenever the program has the potential to access any per-thread data. --- src/thread/pthread_self.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/thread/pthread_self.c') diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c index cc2ddfb7..51f12bb3 100644 --- a/src/thread/pthread_self.c +++ b/src/thread/pthread_self.c @@ -19,7 +19,7 @@ static int init_main_thread() return 0; } -pthread_t pthread_self() +pthread_t __pthread_self_def() { static int init, failed; if (!init) { @@ -31,4 +31,5 @@ pthread_t pthread_self() return __pthread_self(); } -weak_alias(pthread_self, __pthread_self_init); +weak_alias(__pthread_self_def, pthread_self); +weak_alias(__pthread_self_def, __pthread_self_init); -- cgit v1.2.1