diff options
author | Christopher Faylor <me@cgf.cx> | 2000-05-18 07:20:01 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-05-18 07:20:01 +0400 |
commit | 12e659efa8f172167a526f251e36571f6f976740 (patch) | |
tree | af0e1b0e10b0d1f85074c9a0bc2fd3aadb4fe17e /winsup | |
parent | 2dc173fe91dfdf9fbf2844f54bb064f43a8c0004 (diff) |
* 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.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 10 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/sigproc.h | 7 | ||||
-rw-r--r-- | winsup/cygwin/sync.cc | 2 |
5 files changed, 22 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 502db20b0..896bf613e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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 diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 9810fd000..6d5e8dbd7 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -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]); diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 27541667d..7c18e6259 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -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"); diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index eee35748f..3f713c348 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -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) : diff --git a/winsup/cygwin/sync.cc b/winsup/cygwin/sync.cc index 2ca3a27ac..5036c3d1d 100644 --- a/winsup/cygwin/sync.cc +++ b/winsup/cygwin/sync.cc @@ -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) { |