diff options
author | Christopher Faylor <me@cgf.cx> | 2003-12-07 02:56:52 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-12-07 02:56:52 +0000 |
commit | 73262d7a44b90e2338fe031ebeaa17c7a299d547 (patch) | |
tree | d3de2229068da0c0aaf0b20eb206858f67871148 /winsup | |
parent | fcc47fd0013d63dfe43b81ec26ad10eea5a05cbe (diff) | |
download | newlib-73262d7a44b90e2338fe031ebeaa17c7a299d547.zip newlib-73262d7a44b90e2338fe031ebeaa17c7a299d547.tar.gz newlib-73262d7a44b90e2338fe031ebeaa17c7a299d547.tar.bz2 |
* cygtls.h (_threadinfo::find_tls): New function.
* exceptions.cc (_threadinfo::find_tls): Rename from find_tls. Use critical
section to protect access to linked list.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/cygtls.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8b5fef6..832b39f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,11 @@ 2003-12-06 Christopher Faylor <cgf@redhat.com> + * cygtls.h (_threadinfo::find_tls): New function. + * exceptions.cc (_threadinfo::find_tls): Rename from find_tls. Use + critical section to protect access to linked list. + +2003-12-06 Christopher Faylor <cgf@redhat.com> + * exceptions.cc (_threadinfo::remove): Avoid returning without unlocking critical section in the (hopefully impossible) case of an unrecognized thread. diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 20913be..f62efed 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -46,6 +46,7 @@ struct _threadinfo void init_thread (void *); static void call (void (*) (void *, void *), void *); void call2 (void (*) (void *, void *), void *, void *); + static struct _threadinfo *find_tls (int sig); void remove (); void push (__stack_t, bool = false); __stack_t pop (); diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index aba96ec..ea2c7e6 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -988,11 +988,13 @@ set_signal_mask (sigset_t newmask, sigset_t& oldmask) } _threadinfo * -find_tls (int sig) +_threadinfo::find_tls (int sig) { + EnterCriticalSection (&protect_linked_list); for (_threadinfo *t = _last_thread; t ; t = t->prev) if (sigismember (&t->sigwait_mask, sig)) return t; + LeaveCriticalSection (&protect_linked_list); return NULL; } @@ -1023,7 +1025,7 @@ sig_handle (int sig, sigset_t mask, int pid, _threadinfo *tls) || ISSTATE (myself, PID_STOPPED))) { sigproc_printf ("signal %d blocked", sig); - if (insigwait_mask || (tls = find_tls (sig)) != NULL) + if (insigwait_mask || (tls = _threadinfo::find_tls (sig)) != NULL) goto thread_specific; rc = -1; goto done; |