Recently we released a Lua library to support OS multithreading - Effil.
Here is github repo and small project overview.
Comparing to other threading solutions this is easier to use and has more features:
- Manageable threads: pause/resume and cancel
- Tables transmittable between threads + metatables
- FIFO channels
Code: Select all
effil = require "effil"
function foo(functor)
for i = 1, 100 do
functor(i)
end
end
storage = effil.setmetatable(
{ val = 0 },
{__call = function(t, val) t.val = t.val + val end }
)
thread = effil.thread(foo)(storage) -- run separate OS thread
thread:wait() -- wait for thread completion
print(storage.val) -- prints '5050'
In case of interest I will try to make Effil build compatible with Love2d objects or even embed it into engine!