]> git.lizzy.rs Git - minetest.git/blob - builtin/async_env.lua
Fix possible missing unlock of env_lock
[minetest.git] / builtin / async_env.lua
1 engine.log("info","Initializing Asynchronous environment")
2
3 dofile(SCRIPTDIR .. DIR_DELIM .. "misc_helpers.lua")
4
5 function engine.job_processor(serialized_function, serialized_data)
6
7         local fct = marshal.decode(serialized_function)
8         local params = marshal.decode(serialized_data)
9         local retval = marshal.encode(nil)
10
11         if fct ~= nil and type(fct) == "function" then
12                 local result = fct(params)
13                 retval = marshal.encode(result)
14         else
15                 engine.log("error","ASYNC WORKER: unable to deserialize function")
16         end
17
18         return retval,retval:len()
19 end