diff options
Diffstat (limited to 'rts/win32/IOManager.c')
-rw-r--r-- | rts/win32/IOManager.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c index 6af42456ae..6e7cd25b7a 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. */ |