[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Preemptive Multitasking and Pseudo-Forking
- From: duck <duck@...>
- Date: Wed, 15 Oct 2008 22:06:26 +1100 (EST)
>As far as I understand it, the Lua interpreter
>is fully reentrant and running it in different
>(OS native) threads -- of course with each thread
>having its own Lua state -- is no problem at all.
>Of course without further plumbing those threads
>would not have any Lua-intrinsic means of
>inter-thread-communication.
I quite like this one:
http://luatask.luaforge.net/
Multiple concurrent, independent Lua threads with message passing.
Efficient multithreading without the mutexes!
Easy to learn and use. Decent documentation.
LuaTask's message passing lets you send and receive arbitrary strings
between tasks. Of course, this means that if you want to pass Lua tables
between tasks, you need to serialise (convert them to byte-strings) and
unserialise them at each end. But there are numerous examples of
serialisation code on the Wiki.
Uses pthreads on Linux and either native Windows threads or pthreads on
Windows.