[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Latent functions
- From: "Jay Carlson" <nop@...>
- Date: Mon, 3 Dec 2001 11:06:44 -0500
"Thatcher Ulrich" <tu@tulrich.com> writes:
> I was just reading through the list archives about coroutines and
> cooperative multitasking. Unfortunately, the external C-level
> coroutine approach of 4.1 won't work for me, and I think I'm in the
> same boat with many other game developers. The problem is, the state
> of Lua scripts must be serializable, and a C-level coroutine library
> (or something using setjmp/longjmp) makes this unworkable. I'm OK
> with the restricted sleep() as described by Bret Mogilefsky.
This would be useful to me as well. The LambdaMOO system is based on a
persistent workspace, and it's implemented with a periodic checkpoint of
world state. It serializes task (thread) state, and I believe that some
servers have been running particular tasks for several years, across
hardware and OS reboots.
I think LambdaMOO is at a local maximum, and I've been toying with the idea
of building something in the spirit of MOO using Lua. Although MOO survived
many years without coroutines, I think any new system in the niche should
have a plan for how to support tasks.
> I guess what's needed is a power-patch to make OP_CALL non-recursive,
> and remove OP_TAILCALL from the compiler, and then a few support
> routines. It looks like Bret left some good pointers for how to do
> it. Before I duplicate this effort for the umpteenth time, does
> anybody have any actual code to share?
Why do you need to remove OP_TAILCALL?
Also, C code that wants to call back into Lua will have to play nice with
this scheme. Instead of executing lua_call, it will need to push the
function and args on the stack and *return* to the bytecode engine, and let
the engine do the call.
Jay