[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Creating Threads in Lua 4.0
- From: "Sebby " <beast@...>
- Date: Mon, 09 Oct 2000 15:16:06 -0000
Hello.
You may remember me from such thread as : "Using Lua in Video
Games". :) Now i am back with a new question. This one isn't
necessarily related to video games but more on how to create threads
from within Lua.
Now, for my application, it would be interesting to create multiple
Lua threads which could execute at the same time and exchange
information. Note that i am not talking about using threads on the
host system since there is no multi-threading availible on PSX2 but
i'm mostly talking about simulating threads.
Now, Lua 4.0 is now re-entrant. I thought this could be one solution.
But from my understanding, each Lua state creates contains it's own
environement (including globals, registered functions, ...). So in
essence, this simulates the concept of "Process" but not "Threads".
So my question is this. Is there a way to interrupt a lua task mid-
way (i'm assuming the VM of lua should be in a stable state after
every p-code), save the current state of the task and preempt a new
task into it's state?
Any input on this would be grateley apreciated.
Sebastien St-Laurent
Soft Engineer
sebby@z-axis.com