Improve ThreadPool job chaining.
This commit is contained in:
@@ -313,6 +313,17 @@ class ThreadPool extends BackgroundWorker
|
||||
case COMPLETE, ERROR:
|
||||
activeThreads--;
|
||||
|
||||
// Call `onComplete` before closing threads, in case the
|
||||
// listener queues a new job.
|
||||
if (threadEvent.event == COMPLETE)
|
||||
{
|
||||
onComplete.dispatch(threadEvent.state);
|
||||
}
|
||||
else
|
||||
{
|
||||
onError.dispatch(threadEvent.state);
|
||||
}
|
||||
|
||||
#if (!force_synchronous && (target.threaded || cpp || neko))
|
||||
if (mode == MULTI_THREADED
|
||||
&& ((__numPendingJobs > idleThreads && currentThreads > minThreads)
|
||||
@@ -323,15 +334,6 @@ class ThreadPool extends BackgroundWorker
|
||||
}
|
||||
#end
|
||||
|
||||
if (threadEvent.event == COMPLETE)
|
||||
{
|
||||
onComplete.dispatch(threadEvent.state);
|
||||
}
|
||||
else
|
||||
{
|
||||
onError.dispatch(threadEvent.state);
|
||||
}
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user