diff options
author | Christopher Faylor <me@cgf.cx> | 2002-10-06 01:01:58 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-10-06 01:01:58 +0000 |
commit | 09663d31bbc2c9784be39e696ce0fa6579319dd4 (patch) | |
tree | 7fa073bbe87cd678136d2ad5049e6fed1687ae7e | |
parent | f8f63f9bc14f857a5a626e6855e318662450cf04 (diff) | |
download | newlib-09663d31bbc2c9784be39e696ce0fa6579319dd4.zip newlib-09663d31bbc2c9784be39e696ce0fa6579319dd4.tar.gz newlib-09663d31bbc2c9784be39e696ce0fa6579319dd4.tar.bz2 |
* cygthread.cc (cygthread::stub): Very minor cleanup.
(cygthread::stub): Report overflows in cygwin thread pool when DEBUGGING is on
and special environment variable is not set.
(cygthread::terminate): Set event only when event actually exists.
* exceptions.cc (signal_exit): Set priority of main thread to low before
setting current thread to high.
-rw-r--r-- | winsup/cygwin/ChangeLog | 9 | ||||
-rw-r--r-- | winsup/cygwin/cygthread.cc | 11 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 3 |
3 files changed, 16 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 077d43b..cc93104 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2002-10-05 Christopher Faylor <cgf@redhat.com> + + * cygthread.cc (cygthread::stub): Very minor cleanup. + (cygthread::stub): Report overflows in cygwin thread pool when + DEBUGGING is on and special environment variable is not set. + (cygthread::terminate): Set event only when event actually exists. + * exceptions.cc (signal_exit): Set priority of main thread to low + before setting current thread to high. + 2002-10-01 Robert Collins <rbtcollins@hotmail.com> * thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index b2a6224..c3b74df 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -68,10 +68,10 @@ cygthread::stub (VOID *arg) #endif SetEvent (info->ev); info->__name = NULL; - if (initialized < 0) - ExitThread (0); - else + if (initialized >= 0) SuspendThread (info->h); + else + ExitThread (0); } } @@ -160,7 +160,7 @@ new (size_t) { #ifdef DEBUGGING char buf[1024]; - if (GetEnvironmentVariable ("CYGWIN_NOFREERANGE", buf, sizeof (buf))) + if (!GetEnvironmentVariable ("CYGWIN_NOFREERANGE_NOCHECK", buf, sizeof (buf))) api_fatal ("Overflowed cygwin thread pool"); #endif return freerange (); @@ -278,7 +278,8 @@ void cygthread::terminate () { initialized = -1; + /* Signal the event for all running threads */ for (cygthread *info = threads + NTHREADS - 1; info >= threads; info--) - if (!(DWORD) InterlockedExchange ((LPLONG) &info->avail, 0) && info->id) + if (!InterlockedExchange ((LPLONG) &info->avail, 0) && info->ev) SetEvent (info->ev); } diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index e15803a..0c8758d 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1084,8 +1084,8 @@ signal_exit (int rc) /* We'd like to stop the main thread from executing but when we do that it causes random, inexplicable hangs. So, instead, we set up the priority of this thread really high so that it should do its thing and then exit. */ - (void) SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL); (void) SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE); + (void) SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_TIME_CRITICAL); /* Unlock any main thread mutos since we're executing with prejudice. */ muto *m; @@ -1166,7 +1166,6 @@ int sigframe::call_signal_handler () { return unregister () ? call_signal_handler_now () : 0; - } #define pid_offset (unsigned)(((_pinfo *)NULL)->pid) |