diff options
Diffstat (limited to 'hurd/hurd/signal.h')
-rw-r--r-- | hurd/hurd/signal.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index e15860aec6..8d63d2d0c0 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -162,13 +162,14 @@ extern void _hurd_sigstate_delete (thread_t thread); _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate * _hurd_self_sigstate (void) { - if (THREAD_SELF->_hurd_sigstate == NULL) + struct hurd_sigstate **location = &THREAD_SELF->_hurd_sigstate; + if (*location == NULL) { thread_t self = __mach_thread_self (); - THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (self); + *location = _hurd_thread_sigstate (self); __mach_port_deallocate (__mach_task_self (), self); } - return THREAD_SELF->_hurd_sigstate; + return *location; } #endif @@ -197,6 +198,7 @@ void *_hurd_critical_section_lock (void); _HURD_SIGNAL_H_EXTERN_INLINE void * _hurd_critical_section_lock (void) { + struct hurd_sigstate **location; struct hurd_sigstate *ss; #ifdef __LIBC_NO_TLS @@ -205,7 +207,8 @@ _hurd_critical_section_lock (void) return NULL; #endif - ss = THREAD_SELF->_hurd_sigstate; + location = &THREAD_SELF->_hurd_sigstate; + ss = *location; if (ss == NULL) { thread_t self = __mach_thread_self (); @@ -213,9 +216,15 @@ _hurd_critical_section_lock (void) /* 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 +<<<<<<< HEAD way. */ ss = THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (self); __mach_port_deallocate (__mach_task_self (), self); +======= + way; this locks the sigstate lock. */ + ss = *location = _hurd_thread_sigstate (__mach_thread_self ()); + __spin_unlock (&ss->lock); +>>>>>>> t/tls-threadvar } if (! __spin_try_lock (&ss->critical_section_lock)) |