[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luajit ffi - calling a luajit function via a C function pointer?
- From: Leo Razoumov <slonik.az@...>
- Date: Fri, 11 Feb 2011 14:53:55 -0500
On Fri, Feb 11, 2011 at 05:27, Mike Pall <mikelu-1102@mike.de> wrote:
>
> I haven't mentioned one rather strange way out of this: perform
> inversion of control by switching C stacks.
> [..snip..]
> This is a bit like Lua coroutines work, where the iterator yields
> and eval_func() resumes. Except that we're switching C stacks, not
> Lua stacks.
>
> You could implement something like this right now, even without
> any changes to LuaJIT. You'll just have to grab one of the
> lightweight C coroutine libraries and add the required plumbing.
>
This is very interesting approach which can be useful in many places
where Lua->C->Lua
call chain is needed. I can go google for lightweight C coroutine
libraries but if someone has specific recommendations it would help.
--Leo--