* dcrt0.cc (dll_crt0_1): Initialize mainthread stuff here before anything needs

it.
* sigproc.cc (sigproc_init): Move mainthread initialization out of here.
* sigproc.h (sigthread): Add init() method.
(sigframe): Don't try to initialize muto.
* sync.cc: Undef WaitForSingleObject to avoid recursion.
This commit is contained in:
Christopher Faylor 2000-05-18 03:20:01 +00:00
parent 2dc173fe91
commit 12e659efa8
5 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,13 @@
Wed May 17 23:13:32 2000 Christopher Faylor <cgf@cygnus.com>
* dcrt0.cc (dll_crt0_1): Initialize mainthread stuff here before
anything needs it.
* sigproc.cc (sigproc_init): Move mainthread initialization out of
here.
* sigproc.h (sigthread): Add init() method.
(sigframe): Don't try to initialize muto.
* sync.cc: Undef WaitForSingleObject to avoid recursion.
2000-05-17 DJ Delorie <dj@cygnus.com>
* testsuite/winsup.api/crlf.c: New

View File

@ -22,6 +22,8 @@ details. */
HANDLE NO_COPY hMainProc = NULL;
HANDLE NO_COPY hMainThread = NULL;
sigthread NO_COPY mainthread; // ID of the main thread
static NO_COPY char dummy_user_data[sizeof (per_process)] = {0};
per_process NO_COPY *user_data = (per_process *) &dummy_user_data;
@ -624,6 +626,9 @@ dll_crt0_1 ()
or attach to the shared data structure if it's already running. */
shared_init ();
mainthread.init ("mainthread"); // For use in determining if signals
// should be blocked.
if (mypid)
set_myself (cygwin_shared->p[mypid]);

View File

@ -100,7 +100,6 @@ Static waitq waitq_main; // Storage for main thread
muto NO_COPY *sync_proc_subproc = NULL; // Control access to subproc stuff
sigthread NO_COPY mainthread; // ID of the main thread
DWORD NO_COPY sigtid = 0; // ID of the signal thread
int NO_COPY pending_signals = 0; // TRUE if signals pending
@ -604,9 +603,6 @@ sigproc_init ()
to a signal handler function. */
signal_arrived = CreateEvent(&sec_none_nih, TRUE, FALSE, NULL);
mainthread.id = GetCurrentThreadId ();// For use in determining if signals
// should be blocked.
if (!(hwait_sig = makethread (wait_sig, NULL, 0, "sig")))
{
system_printf ("cannot create wait_sig thread, %E");

View File

@ -40,6 +40,11 @@ struct sigthread
DWORD frame;
muto *lock;
sigthread () : id (0), frame (0), lock (0) {}
void init (const char *s)
{
lock = new_muto (FALSE, s);
id = GetCurrentThreadId ();
}
};
class sigframe
@ -50,8 +55,6 @@ private:
public:
void set (sigthread &t, int up = 1)
{
if (!t.lock)
t.lock = new_muto (FALSE, "sigthread");
t.lock->acquire ();
st = &t;
t.frame = (DWORD) (up ? __builtin_frame_address (1) :

View File

@ -23,6 +23,8 @@ details. */
muto NO_COPY muto_start;
#undef WaitForSingleObject
/* Constructor */
muto::muto (int inh, const char *s) : sync (0), visits(0), waiters(-1), tid (0), next (NULL)
{