[ANN] POSIX threads for Lua 5.1

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] POSIX threads for Lua 5.1

Mildred Ki'Lya
Hi evryone,

I created this lua module to have the possibility to use POSIX threads
in lua. It is a first release, so it may have bugs. If you discover
one, please tell me.

The only problem is that you'll have to recompile your lua
distribution, your lua library, and evrything that is linked staticly to
it (that is, all your C modules).
It uses in fact the two C macros, lua_lock and lua_unlock, like the
luaThread library (not (yet) aviable for lua 5.1)
<http://www.cs.princeton.edu/~diego/professional/luathread/>


I tried to use pluto, in order to copy all lua objects, but I didn't
suceed. I'm now trying to create a lua_xcopy function that would be
able to copy lua objects from one lua state to another, without making
links betwen the two lua states. But it's not that easy (especially for
closures/functions and threads :)

I know coroutines can do very powerful things ... but if a C function
block your coroutine somewhere, evrything is blocked :(. And as i
prefer using lua rather than creating a non blocking C binding, I
created this library.

And, the project URLs:

http://luaforge.net/projects/lua51pthread/
http://lua51pthread.luaforge.net/

--
Mildred       <xmpp:[hidden email]> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] POSIX threads for Lua 5.1

Javier Guerra Giraldez
On Monday 10 April 2006 5:38 am, Mildred wrote:
> I tried to use pluto, in order to copy all lua objects, but I didn't
> suceed. I'm now trying to create a lua_xcopy function that would be
> able to copy lua objects from one lua state to another, without making
> links betwen the two lua states. But it's not that easy (especially for
> closures/functions and threads :)

if you're using pthreads, and protecting the lua states with locks; why do you
need to copy objects?  if a lua thread is derived from the original state, it
can directly access any object there.

--
Javier

attachment0 (207 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] POSIX threads for Lua 5.1

Mildred Ki'Lya

On Mon, 10 Apr 2006 07:36:48 -0500 Javier Guerra wrote:
>
> if you're using pthreads, and protecting the lua states with locks;
> why do you need to copy objects?  if a lua thread is derived from the
> original state, it can directly access any object there.
>

I'm searching a way to copy the lua objects because I don't want to
have to recompile the lua executable and all lua modules :)


--
Mildred       <xmpp:[hidden email]> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]