lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sean,

On 18 Jun 2002, Sean Middleditch wrote:

> Again, with Lua's co-threads support, it should be very easy (I would
> imagine - haven't look at internals in a while) to make a
> pre-emptive-ish threading system.  Simply do something akin to forced
> yields, add in Lua mutex/semaphore data types, etc.  The main engine
> would look at all available threads, and run each for X amount of time
> or for X byte-code operations, then return to calling C code.  This way,
> an application could launch Lua threads, and then have a
> "lua_run_threads" call in the main update/event loop.

This is what I'm working on with the "count the byte codes" idea. I'm
trying to see how easy it is and how ugly the implementation will be.
If it seems possible to easily implement a lightweight preemptive
system this way, I'll report it to the list.

  - Tom