forked from Mirrorlandia_minetest/minetest
Fix over-poping and only push the core once
This commit is contained in:
parent
e7706593c6
commit
5bd2aea663
@ -262,6 +262,12 @@ void* AsyncWorkerThread::Thread()
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lua_getglobal(L, "core");
|
||||||
|
if (lua_isnil(L, -1)) {
|
||||||
|
errorstream << "Unable to find core within async environment!";
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (!StopRequested()) {
|
while (!StopRequested()) {
|
||||||
// Wait for job
|
// Wait for job
|
||||||
@ -271,12 +277,6 @@ void* AsyncWorkerThread::Thread()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_getglobal(L, "core");
|
|
||||||
if (lua_isnil(L, -1)) {
|
|
||||||
errorstream << "Unable to find core within async environment!";
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_getfield(L, -1, "job_processor");
|
lua_getfield(L, -1, "job_processor");
|
||||||
if (lua_isnil(L, -1)) {
|
if (lua_isnil(L, -1)) {
|
||||||
errorstream << "Unable to get async job processor!" << std::endl;
|
errorstream << "Unable to get async job processor!" << std::endl;
|
||||||
@ -303,13 +303,16 @@ void* AsyncWorkerThread::Thread()
|
|||||||
toProcess.serializedResult = std::string(retval, length);
|
toProcess.serializedResult = std::string(retval, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop core, job_processor, and retval
|
lua_pop(L, 1); // Pop retval
|
||||||
lua_pop(L, 3);
|
|
||||||
|
|
||||||
// Put job result
|
// Put job result
|
||||||
jobDispatcher->putJobResult(toProcess);
|
jobDispatcher->putJobResult(toProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lua_pop(L, 1); // Pop core
|
||||||
|
|
||||||
log_deregister_thread();
|
log_deregister_thread();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user