terminate thread if it didn't complete during MAX_SCRIPT_QUITTING_TIME

This commit is contained in:
Alexander Ivash 2018-06-06 03:52:22 +03:00 committed by Seth Alves
parent 8d173e0a9b
commit da92ff993f

View file

@ -419,7 +419,7 @@ void ScriptEngine::waitTillDoneRunning() {
// Wait for the scripting thread to stop running, as
// flooding it with aborts/exceptions will persist it longer
static const auto MAX_SCRIPT_QUITTING_TIME = 0.5 * MSECS_PER_SECOND;
if (workerThread->wait(MAX_SCRIPT_QUITTING_TIME)) {
if (!workerThread->wait(MAX_SCRIPT_QUITTING_TIME)) {
workerThread->terminate();
}
}