* assert.cc (__assert): Call debugger on assertion failure if debugging.

* dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather than
going through the overhead of invoking it.
* fork.cc (fork_child): Ditto.
* exceptions.cc (signal_fixup_after_fork): Call sigproc_init here.
* sigproc.cc (proc_can_be_signalled): Assume that the signal thread is live.
(sig_dispatch): Ditto.
(sig_send): Ditto.
(wait_for_sigthread): Renamed from "wait_for_me".  Assume that wait_sig_inited
has been set and that this function is only called from the main thread.
* winsup.h (wait_for_sigthread): Declare new function.
This commit is contained in:
Christopher Faylor 2002-08-11 19:19:29 +00:00
parent 2324fd5b91
commit 3cb62bd614
7 changed files with 41 additions and 25 deletions

View File

@ -1,3 +1,20 @@
2002-08-11 Christopher Faylor <cgf@redhat.com>
* assert.cc (__assert): Call debugger on assertion failure if
debugging.
* dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather
than going through the overhead of invoking it.
* fork.cc (fork_child): Ditto.
* exceptions.cc (signal_fixup_after_fork): Call sigproc_init here.
* sigproc.cc (proc_can_be_signalled): Assume that the signal thread is
live.
(sig_dispatch): Ditto.
(sig_send): Ditto.
(wait_for_sigthread): Renamed from "wait_for_me". Assume that
wait_sig_inited has been set and that this function is only called from
the main thread.
* winsup.h (wait_for_sigthread): Declare new function.
2002-08-08 Christopher Faylor <cgf@redhat.com> 2002-08-08 Christopher Faylor <cgf@redhat.com>
* environ.cc (parse_options): Remember the "no" part of any options for * environ.cc (parse_options): Remember the "no" part of any options for

View File

@ -46,6 +46,9 @@ __assert (const char *file, int line, const char *failedexpr)
failedexpr, file, line); failedexpr, file, line);
} }
#ifdef DEBUGGING
try_to_debug ();
#endif
abort (); // FIXME: Someday this should work. abort (); // FIXME: Someday this should work.
/* NOTREACHED */ /* NOTREACHED */

View File

@ -774,7 +774,7 @@ dll_crt0_1 ()
/* Flush signals and ensure that signal thread is up and running. Can't /* Flush signals and ensure that signal thread is up and running. Can't
do this for noncygwin case since the signal thread is blocked due to do this for noncygwin case since the signal thread is blocked due to
LoadLibrary serialization. */ LoadLibrary serialization. */
sig_send (NULL, __SIGFLUSH); wait_for_sigthread ();
set_errno (0); set_errno (0);

View File

@ -715,15 +715,16 @@ interrupt_now (CONTEXT *ctx, int sig, void *handler, struct sigaction& siga)
void __stdcall void __stdcall
signal_fixup_after_fork () signal_fixup_after_fork ()
{ {
if (!sigsave.sig) if (sigsave.sig)
return;
sigsave.sig = 0;
if (sigsave.retaddr_on_stack)
{ {
*sigsave.retaddr_on_stack = sigsave.retaddr; sigsave.sig = 0;
set_process_mask (sigsave.oldmask); if (sigsave.retaddr_on_stack)
{
*sigsave.retaddr_on_stack = sigsave.retaddr;
set_process_mask (sigsave.oldmask);
}
} }
sigproc_init ();
} }
void __stdcall void __stdcall

View File

@ -313,8 +313,7 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
user_data->threadinterface->fixup_after_fork (); user_data->threadinterface->fixup_after_fork ();
/* Initialize signal/process handling */ wait_for_sigthread ();
sigproc_init ();
__pthread_atforkchild (); __pthread_atforkchild ();
cygbench ("fork-child"); cygbench ("fork-child");
return 0; return 0;

View File

@ -17,6 +17,7 @@ details. */
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <assert.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "sync.h" #include "sync.h"
#include "sigproc.h" #include "sigproc.h"
@ -167,19 +168,13 @@ out:
return res; return res;
} }
__inline static void void __stdcall
wait_for_me () wait_for_sigthread ()
{ {
/* See if this is the first signal call after initialization. assert (wait_sig_inited);
* If so, wait for notification that all initialization has completed. (void) WaitForSingleObject (wait_sig_inited, INFINITE);
* Then set the handle to NULL to avoid checking this again. (void) ForceCloseHandle (wait_sig_inited);
*/ wait_sig_inited = NULL;
if (wait_sig_inited)
{
(void) WaitForSingleObject (wait_sig_inited, INFINITE);
(void) ForceCloseHandle (wait_sig_inited);
wait_sig_inited = NULL;
}
} }
/* Get the sync_proc_subproc muto to control access to /* Get the sync_proc_subproc muto to control access to
@ -210,7 +205,7 @@ proc_can_be_signalled (_pinfo *p)
{ {
if (p == myself_nowait || p == myself_nowait_nonmain || p == myself) if (p == myself_nowait || p == myself_nowait_nonmain || p == myself)
{ {
wait_for_me (); assert (!wait_sig_inited);
return 1; return 1;
} }
@ -535,7 +530,7 @@ sig_dispatch_pending (int justwake)
#endif #endif
else else
{ {
wait_for_me (); assert (!wait_sig_inited);
if (!justwake) if (!justwake)
(void) sig_send (myself, __SIGFLUSH); (void) sig_send (myself, __SIGFLUSH);
else if (ReleaseSemaphore (sigcatch_nosync, 1, NULL)) else if (ReleaseSemaphore (sigcatch_nosync, 1, NULL))
@ -657,7 +652,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp, bool exception)
{ {
if (no_signals_available ()) if (no_signals_available ())
goto out; // Either exiting or not yet initializing goto out; // Either exiting or not yet initializing
wait_for_me (); assert (!wait_sig_inited);
wait_for_completion = p != myself_nowait; wait_for_completion = p != myself_nowait;
p = myself; p = myself;
} }

View File

@ -118,6 +118,7 @@ int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_addre
bool exception = 0) __attribute__ ((regparm(3))); bool exception = 0) __attribute__ ((regparm(3)));
void __stdcall signal_fixup_after_fork (); void __stdcall signal_fixup_after_fork ();
void __stdcall signal_fixup_after_exec (bool); void __stdcall signal_fixup_after_exec (bool);
void __stdcall wait_for_sigthread ();
extern char myself_nowait_dummy[]; extern char myself_nowait_dummy[];
extern char myself_nowait_nonmain_dummy[]; extern char myself_nowait_nonmain_dummy[];