lua-users home
lua-l archive

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


>Looking through the Lua 4.1 API, there are these exciting new functions
>about threads, but what I *really* miss, is the stop-and-continue-later
>functions, which would make cooperative multitasking something done in
>no-time. Have anyone patched LUA to provide this functionality, or done
>something else which gives the same functionality?

Lua 4.1 has support for external multi-threading and coroutines.
This means that if your OS and C library have multi-threading or coroutines,
then it should be possible to write a Lua library to export those to Lua.

Requests for stop-and-continue-later functionality come up every now and then.
My impression is that this is a software architecture problem, which is largely
independent of Lua. Implementing stop-and-continue-later in the core of Lua is
not easy, because of the way C and Lua functions intermingle. On the other
hand, implementing stop-and-continue-later *illusion* can be done effectively
with coroutines. For instance E. Toernig's coro library has co_resume.
See lecker.essen.de/~froese/coro/coro.html .

I wish we had a coroutine library for Lua 4.1. Perhaps ET has one already?
--lhf