From 09663d31bbc2c9784be39e696ce0fa6579319dd4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 6 Oct 2002 01:01:58 +0000 Subject: * 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. --- winsup/cygwin/cygthread.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/cygthread.cc') diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index b2a62247b..c3b74dfb0 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); } -- cgit v1.2.3