X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fwin32%2FIOManager.c;h=6e7cd25b7ad3542bd751e407e97de7e5685678da;hb=eb5791fe867f6441d270344298678f45ed4a75e4;hp=6af42456aef203a80e816d613eadf3f0833fd7e0;hpb=681aad99cb29ce54f72ec2a916fb1aab0fa0fabb;p=ghc-hetmet.git diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c index 6af4245..6e7cd25 100644 --- a/rts/win32/IOManager.c +++ b/rts/win32/IOManager.c @@ -443,25 +443,27 @@ AddProcRequest ( void* proc, return depositWorkItem(reqID, wItem); } -void ShutdownIOManager ( void ) +void ShutdownIOManager ( rtsBool wait_threads ) { int num; SetEvent(ioMan->hExitEvent); - /* Wait for all worker threads to die. */ - for (;;) { - EnterCriticalSection(&ioMan->manLock); - num = ioMan->numWorkers; - LeaveCriticalSection(&ioMan->manLock); - if (num == 0) - break; - Sleep(10); + if (wait_threads) { + /* Wait for all worker threads to die. */ + for (;;) { + EnterCriticalSection(&ioMan->manLock); + num = ioMan->numWorkers; + LeaveCriticalSection(&ioMan->manLock); + if (num == 0) + break; + Sleep(10); + } + FreeWorkQueue(ioMan->workQueue); + CloseHandle(ioMan->hExitEvent); + free(ioMan); + ioMan = NULL; } - FreeWorkQueue(ioMan->workQueue); - CloseHandle(ioMan->hExitEvent); - free(ioMan); - ioMan = NULL; } /* Keep track of WorkItems currently being serviced. */