[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua and light threads
- From: "Stefano Lanzavecchia" <stf@...>
- Date: Fri, 20 Oct 2000 12:28:49 +0200
Hi everybody,
after lurking for a little while (and after I read ALL the archive, all its
2700 odd messages) I decided it's time to introduce myself.
I am yet another script integrator who was drawn to Lua by its simplicity,
versatility and power. And because the project I am involved with is a
videogame (where did I hear this before?) I am very intrigued by the
possibility of making Lua support light threads. I call light threads,
threads controlled by a simple scheduler sitting on top of the main VM loop
and so far these are my conclusions (no code written yet):
1) it is possible (the way Bret did years ago) to unwind the stack (i.e.:
not rely on C recursive calls) at least for pure Lua-to-Lua function
invocation, but it would mean a lot of work and a lot of changes to the
various files in the source code to implement the same thing for all the tag
methods, since all of them are implemented as calls to different C routines
eventually calling luaD_call or friends. Because all the implementations of
OO paradigms on Lua are based on tag methods (index, settable, setglobal,
getglobal and so on) if this wasn't done, the scheduler would be very very
jumpy; I don't know now how to reconcile this fact with the perceived need
to maintain the set of changes to a minimum, and not to manually inline into
luaVM_execute all the external C calls so that the VM becomes (almost)
stackless;
2) it would be easy to stop the scheduler from intruding in the case of a
Lua->C->Lua sequence of calls, so that's not an issue;
3) I don't quite see (it's my ignorance on the subject) how setjmp/longjmp
could help in this matter. If anybody wanted to share their experience with
me on the subject, I would be more than grateful.
The pointer to the stackless Python is indeed very welcome and I can see I
am going to print a read a lot of documents and code. Yet, I'd rather not
get involved with Python, which, for reasons described earlier in this
maillist, is not as optimal as Lua for my specific problem.
A heart-felt "thank you" to the developers at Teccgraf who are so nice and
let us have the fruit of their work for free.
--
WildHeart'2k - mailto:stf@apl.it
Homepage: http://come.to/wildheart/
<<<...kon'ya dake ii wa (...ashita made ii wa) ---
...just for tonight, it's OK (...until tomorrow, it's OK)>>>