lua-users home
lua-l archive

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


> My code, Lua Lanes, is an addon library so it requires no patching to Lua
> itself. You'd bring up one "lane" (separate Lua state, and OS thread) that
> would take in the callbacks and forward them to Lindas, which are
> inter-state coordinated data moving vehicles. Think of them as shared tables
> (with FIFO behaviour if required).

Here's my understanding of the situation: the callback (a lua
function) is going to be called from a thread in the asynchronous
library, which needs the lua state in which the callback resides to be
in a consistent state at the moment of entrance. Considering that the
state is the state of a lua lane, the question is: can I suspend a
lane into a *reentrant* position of its lua state, and only after it
ran some initialization code (I need it to load the callback function
in the first place)? Does this makes any sense to you or am I asking
the wrong questions here?

> Yet another approach, which I have taken years back with SDL audio
> callbacks, was to craft my own C-side data structures that would be filled
> with the callbacks and emptied by a poll from Lua. There the issue becomes
> how general purpose you want it to be. If only a flow of numbers, even this
> should do.

If I can find the "general pattern of async. callbacks", it's all a
matter of putting it in a standard library, then the bindings will
flow :) It can even have a lil'more complex interface to cover a wide
range of usage cases, as long as it's a lua-only interface. Ideas
welcomed :)