Added core.try wrapping of function passed to core.add_thread

This commit is contained in:
rxi 2020-04-21 23:23:08 +01:00
parent b7ec7a6acf
commit 4191cf2c08

View file

@ -173,7 +173,8 @@ end
function core.add_thread(f, weak_ref) function core.add_thread(f, weak_ref)
local key = weak_ref or #core.threads + 1 local key = weak_ref or #core.threads + 1
core.threads[key] = { cr = coroutine.create(f), wake = 0 } local fn = function() return core.try(f) end
core.threads[key] = { cr = coroutine.create(fn), wake = 0 }
end end