summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-03-05 06:34:55 +0000
committerChristopher Faylor <me@cgf.cx>2000-03-05 06:34:55 +0000
commit68997e887db7fdedb8f1ca138539a699d9a6d30e (patch)
tree0190e44dc73bdd4a71f84254a4daf3aa3bef3ad6
parented8e99bf3792cbb3d9e462fcd959c98425f6e4bc (diff)
downloadcygnal-68997e887db7fdedb8f1ca138539a699d9a6d30e.tar.gz
cygnal-68997e887db7fdedb8f1ca138539a699d9a6d30e.tar.bz2
cygnal-68997e887db7fdedb8f1ca138539a699d9a6d30e.zip
* exceptions.cc (call_handler): Streamline to use only one call to
ResumeThread. * sigproc.cc (sig_send): Use a muto around the ReleaseSemaphore. Remove priority setting since it didn't solve anything.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/exceptions.cc14
-rw-r--r--winsup/cygwin/sigproc.cc28
3 files changed, 37 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 485e04eb3..04fdabf0a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+Sun Mar 5 01:17:05 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * exceptions.cc (call_handler): Streamline to use only one call to
+ ResumeThread.
+ * sigproc.cc (sig_send): Use a muto around the ReleaseSemaphore.
+ Remove priority setting since it didn't solve anything.
+
Tue Feb 29 00:46:09 2000 Christopher Faylor <cgf@cygnus.com>
* sigproc.cc (sig_send): Temporarily set priority to highest while
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index dfacbc935..dae689285 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -719,7 +719,7 @@ call_handler (int sig, struct sigaction& siga, void *handler)
SetEvent (signal_arrived); // For an EINTR case
sigproc_printf ("armed signal_arrived");
exec_exit = sig; // Maybe we'll exit with this value
- goto out;
+ goto out1;
}
hth = myself->getthread2signal ();
@@ -749,7 +749,7 @@ call_handler (int sig, struct sigaction& siga, void *handler)
Sleep (0);
}
- sigproc_printf ("suspend said %d, %E", res);
+ sigproc_printf ("SuspendThread returned %d", res);
if (sigsave.cx)
{
@@ -764,7 +764,6 @@ call_handler (int sig, struct sigaction& siga, void *handler)
if (!GetThreadContext (hth, cx))
{
system_printf ("couldn't get context of main thread, %E");
- ResumeThread (hth);
goto out;
}
}
@@ -787,9 +786,11 @@ call_handler (int sig, struct sigaction& siga, void *handler)
proc_subproc(PROC_CLEARWAIT, 1);
}
- (void) ResumeThread (hth);
-
out:
+ res = ResumeThread (hth);
+ sigproc_printf ("ResumeThread returned %d", res);
+
+out1:
sigproc_printf ("returning %d", interrupted);
return interrupted;
}
@@ -1046,6 +1047,9 @@ events_init (void)
*end = '\0';
}
windows_system_directory_length = end - windows_system_directory;
+ debug_printf ("windows_system_directory '%s', windows_system_directory_length %d",
+ windows_system_directory, windows_system_directory_length);
+ debug_printf ("cygwin_hmodule %p", cygwin_hmodule);
}
void
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 0c26f2f93..dd4e00f5a 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -99,8 +99,8 @@ Static int nzombies = 0; // Number of deceased children
Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
Static waitq waitq_main; // Storage for main thread
-muto NO_COPY *sync_proc_subproc = NULL; // Control access to
- // subproc stuff
+muto NO_COPY *sync_proc_subproc = NULL; // Control access to subproc stuff
+muto NO_COPY *sync_sig_send = NULL; // Control access to sig_send
DWORD NO_COPY maintid = 0; // ID of the main thread
DWORD NO_COPY sigtid = 0; // ID of the signal thread
@@ -618,6 +618,7 @@ sigproc_init ()
* access to the children and zombie arrays.
*/
sync_proc_subproc = new_muto (FALSE, NULL);
+ sync_sig_send = new_muto (FALSE, NULL);
/* Initialize waitq structure for main thread. A waitq structure is
* allocated for each thread that executes a wait to allow multiple threads
@@ -770,18 +771,25 @@ sig_send (pinfo *p, int sig)
if (sd == NULL)
sd = signal_dispatch_storage.create ();
#endif
+
+ sync_sig_send->acquire ();
/* Increment the sigtodo array to signify which signal to assert.
*/
(void) InterlockedIncrement (p->getsigtodo(sig));
/* Notify the process that a signal has arrived.
*/
- int prio;
SetLastError (0);
+
+#if 0
+ int prio;
prio = GetThreadPriority (GetCurrentThread ());
(void) SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL);
+#endif
+
if (!ReleaseSemaphore (thiscatch, 1, NULL) && (int) GetLastError () > 0)
{
+sigproc_printf ("ReleaseSemaphore failed, %E");
/* Couldn't signal the semaphore. This probably means that the
* process is exiting.
*/
@@ -799,6 +807,7 @@ sig_send (pinfo *p, int sig)
}
goto out;
}
+sigproc_printf ("ReleaseSemaphore succeeded");
/* No need to wait for signal completion unless this was a signal to
* this process.
@@ -809,16 +818,19 @@ sig_send (pinfo *p, int sig)
*/
if (!wait_for_completion)
{
- rc = WAIT_OBJECT_0;
- sip_printf ("Not waiting for sigcomplete. its_me %d sig %d", its_me, sig);
- if (!its_me)
- ForceCloseHandle (thiscatch);
+ rc = WAIT_OBJECT_0;
+ sip_printf ("Not waiting for sigcomplete. its_me %d sig %d", its_me, sig);
+ sync_sig_send->release ();
+ if (!its_me)
+ ForceCloseHandle (thiscatch);
}
else
{
sip_printf ("Waiting for thiscomplete %p", thiscomplete);
SetLastError (0);
+ sync_sig_send->release ();
+Sleep (0);
rc = WaitForSingleObject (thiscomplete, WSSC);
/* Check for strangeness due to this thread being redirected by the
signal handler. Sometimes a WAIT_TIMEOUT will occur when the
@@ -829,7 +841,9 @@ sig_send (pinfo *p, int sig)
rc = WAIT_OBJECT_0;
}
+#if 0
SetThreadPriority (GetCurrentThread (), prio);
+#endif
if (rc == WAIT_OBJECT_0)
rc = 0; // Successful exit