lua-users home
lua-l archive

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



Cosmin Apreutesei kirjoitti 7.8.2009 kello 2:07:

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?

You're asking the right question.

The hidden Linda Lua state is not executing any code. It's there just for data storage, and obviously has locks for this purpose.

Sorry that I really don't remember the inside details without looking at the code (which I won't now) but let's say it's this:

	- linda Lua state is normally hibernating, and available (not locked)
- read or write of lindas will naturally lock the state for the duration of the access - async callbacks should use a C function exposed by Lanes (hopefully, check the code!) to allow C libaries access linda content

But I think this is not the solution you want. Your mental plane is more towards the alien world :) and that would not like a dependency on an otherwise unnecessary extension library, I think.

Wanted yet to clarify the Lanes side.  Have a good day!

-asko