[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: multithreading Lua. Was Re: kill coroutine
 
- From: Rici Lake <lua@...>
 
- Date: Sat, 20 Aug 2005 23:05:02 -0500
 
On 20-Aug-05, at 9:42 PM, Antero Vipunen wrote:
IMHO the original question was about killing coroutine running in one 
thread from another.
Perhaps, but that's not how I read it. The original question didn't use 
the word "thread" and probably I shouldn't have either because it is 
always confusing.
 Then correct answer will be "Original Lua distribution is not thread 
safe.
I guess that depends on how you define thread-safe. The Lua 
distribution is thread-safe in the sense that you can freely use two 
different Lua contexts in different threads. That is, unlike many 
libraries, it does not use any mutable globals at all and two Lua 
contexts do not interact with each other. (By the way, the readline 
library is not threadsafe, but it is only used in the stand-alone Lua 
interpreter. I think the other libraries used by Lua have threadsafe 
versions.)
 And without modifications root lua_State can be accessed only inside 
one thread.
Or at least, only inside one thread at a time. :)
I wrote a bunch of stuff about Lua and thread-safety but I really don't 
think it fits in this thread. So I'll post it separately.
Rici.