From d3bda1df95dd1e368ec03b1a1b9e3f0260b4cbfc Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 24 Feb 2000 19:54:01 +0000 Subject: * exceptions.cc (call_handler): Use new muto linked list to look for all potential mutos owned by suspended thread. Clear waiting threads while thread is stopped. (proc_subproc): Clarify debugging output. * sync.h (class muto): Add 'next' field. (new_muto): Keep linked list alive. --- winsup/cygwin/exceptions.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'winsup/cygwin/exceptions.cc') diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 4176f66cc..3213aa972 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -713,7 +713,6 @@ call_handler (int sig, struct sigaction& siga, void *handler) CONTEXT *cx, orig; int interrupted = 1; int res; - extern muto *sync_proc_subproc; if (hExeced != NULL && hExeced != INVALID_HANDLE_VALUE) { @@ -743,10 +742,13 @@ call_handler (int sig, struct sigaction& siga, void *handler) goto set_pending; /* FIXME: Make multi-thread aware */ - if (!sync_proc_subproc->unstable () && sync_proc_subproc->owner () != maintid && - !mask_sync->unstable () && mask_sync->owner () != maintid) - break; + for (muto *m = muto_start.next; m != NULL; m = m->next) + if (m->unstable () || m->owner () == maintid) + goto keep_looping; + + break; + keep_looping: ResumeThread (hth); Sleep (0); } @@ -781,12 +783,16 @@ call_handler (int sig, struct sigaction& siga, void *handler) interrupted = 0; } - (void) ResumeThread (hth); - if (interrupted) { /* Clear any waiting threads prior to dispatching to handler function */ proc_subproc(PROC_CLEARWAIT, 1); + } + + (void) ResumeThread (hth); + + if (interrupted) + { /* Apparently we have to set signal_arrived after resuming the thread or it is possible that the event will be ignored. */ (void) SetEvent (signal_arrived); // For an EINTR case -- cgit v1.2.3