diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-04-22 16:16:41 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-04-22 16:16:41 +0200 |
commit | 6215d24ad8586ed6a080814d4de802b3481e0870 (patch) | |
tree | d8d245738e4416775d8707ae4b66cf0cde053fd8 /hurd | |
parent | 3f5671523f26e6558eef6d0e4fcd2af165634e93 (diff) | |
parent | b8198bf5e16c23c074ddc9fa40931c9c9bf7b722 (diff) |
Merge branch 't/tls-threadvar' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts:
hurd/hurd/signal.h
Diffstat (limited to 'hurd')
-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)) |