Fix shutdown when no worker tasks have been used.

This commit is contained in:
Sönke Ludwig 2017-02-22 23:26:16 +01:00
parent 76882b3bd7
commit 3dbdc90927
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -1256,8 +1256,10 @@ static ~this()
if (is_main_thread) { if (is_main_thread) {
shared(TaskPool) tpool; shared(TaskPool) tpool;
synchronized (st_threadsMutex) swap(tpool, st_workerPool); synchronized (st_threadsMutex) swap(tpool, st_workerPool);
logDiagnostic("Main thread still waiting for worker threads."); if (tpool) {
tpool.terminate(); logDiagnostic("Main thread still waiting for worker threads.");
tpool.terminate();
}
logDiagnostic("Main thread exiting"); logDiagnostic("Main thread exiting");
} }