1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix modstore/favourites hang by adding asynchronous lua job support

This commit is contained in:
sapier 2013-11-26 18:15:31 +01:00
parent b08d7558de
commit 2e66aca357
27 changed files with 2271 additions and 559 deletions

19
builtin/async_env.lua Normal file
View file

@ -0,0 +1,19 @@
engine.log("info","Initializing Asynchronous environment")
dofile(SCRIPTDIR .. DIR_DELIM .. "misc_helpers.lua")
function engine.job_processor(serialized_function, serialized_data)
local fct = marshal.decode(serialized_function)
local params = marshal.decode(serialized_data)
local retval = marshal.encode(nil)
if fct ~= nil and type(fct) == "function" then
local result = fct(params)
retval = marshal.encode(result)
else
engine.log("error","ASYNC WORKER: unable to deserialize function")
end
return retval,retval:len()
end