diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-10-20 19:06:52 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-10-20 19:06:52 +0200 |
commit | 59ff42dc062f858c9e143a41baef62ee05d3b360 (patch) | |
tree | dac962750682b4967898b57ba0f1f64af1c3425b /hurd/hurd/signal.h | |
parent | c8086a22140200e47d54d90607883653e868af77 (diff) | |
parent | c85d2864b23774e723c8e4610ac0cd737dfa40a4 (diff) |
Merge branch 't/tls-threadvar' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts:
hurd/hurd/signal.h
Diffstat (limited to 'hurd/hurd/signal.h')
-rw-r--r-- | hurd/hurd/signal.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index 796761eba4..cc0f795f88 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -159,11 +159,9 @@ extern void _hurd_sigstate_delete (thread_t thread); _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate * _hurd_self_sigstate (void) { - struct hurd_sigstate **location = (struct hurd_sigstate **) - (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE); - if (*location == NULL) - *location = _hurd_thread_sigstate (__mach_thread_self ()); - return *location; + if (_hurd_sigstate == NULL) + _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ()); + return _hurd_sigstate; } #endif @@ -192,16 +190,22 @@ void *_hurd_critical_section_lock (void); _HURD_SIGNAL_H_EXTERN_INLINE void * _hurd_critical_section_lock (void) { - struct hurd_sigstate **location = (struct hurd_sigstate **) - (void *) __hurd_threadvar_location (_HURD_THREADVAR_SIGSTATE); - struct hurd_sigstate *ss = *location; + struct hurd_sigstate *ss; + +#ifdef __LIBC_NO_TLS + if (__LIBC_NO_TLS()) + /* TLS is currently initializing, no need to enter critical section. */ + return NULL; +#endif + + ss = _hurd_sigstate; if (ss == NULL) { /* The thread variable is unset; this must be the first time we've asked for it. In this case, the critical section flag cannot possible already be set. Look up our sigstate structure the slow way; this locks the sigstate lock. */ - ss = *location = _hurd_thread_sigstate (__mach_thread_self ()); + ss = _hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ()); __spin_unlock (&ss->lock); } |