Avoid starting an explicit event loop in worker threads.
This reduces the overhead of task pool threads slightly and simplifies stack traces in case of errors.
This commit is contained in:
parent
dacd12ed99
commit
849bca4855
|
@ -253,14 +253,8 @@ private final class WorkerThread : Thread {
|
||||||
try {
|
try {
|
||||||
if (m_pool.m_state.lock.term) return;
|
if (m_pool.m_state.lock.term) return;
|
||||||
logDebug("entering worker thread");
|
logDebug("entering worker thread");
|
||||||
runTask(&handleWorkerTasks);
|
handleWorkerTasks();
|
||||||
logDebug("running event loop");
|
|
||||||
if (!m_pool.m_state.lock.term) runEventLoop();
|
|
||||||
logDebug("Worker thread exit.");
|
logDebug("Worker thread exit.");
|
||||||
} catch (Exception e) {
|
|
||||||
scope (failure) abort();
|
|
||||||
logFatal("Worker thread terminated due to uncaught exception: %s", e.msg);
|
|
||||||
logDebug("Full error: %s", e.toString().sanitize());
|
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
logFatal("Worker thread terminated due to uncaught error: %s", th.msg);
|
logFatal("Worker thread terminated due to uncaught error: %s", th.msg);
|
||||||
logDebug("Full error: %s", th.toString().sanitize());
|
logDebug("Full error: %s", th.toString().sanitize());
|
||||||
|
@ -307,8 +301,6 @@ private final class WorkerThread : Thread {
|
||||||
if (threads.length > 0 && !queue.empty)
|
if (threads.length > 0 && !queue.empty)
|
||||||
logWarn("Worker threads shut down with worker tasks still left in the queue.");
|
logWarn("Worker threads shut down with worker tasks still left in the queue.");
|
||||||
}
|
}
|
||||||
|
|
||||||
exitEventLoop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue