lua-users home
lua-l archive

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

On 9 Apr 2013, at 07:17, Satz Klauer wrote:

> So to sum it up for my special case I'd prefer the following - as far
> as I understood it:
> I do a global lock as long as the script is running. This lock also
> includes the C-callback function, means it will be called from its own
> thread  but the LUA-part will not be processed.
>> From time to time the user has to call a "handle message" function or
> a "sleep" (the latter one already exists). During this time the thread
> is unlocked and can do its processing and call into the LUA-callback
> function.

Yes, I think what you're saying is my 2nd option, but remember, the callbacks all lock until the script calls the sleep/handle function. Also, in the sleep.handle function, you do need to signal the callbacks to wake up.

If you don't want the user to specifically have to call the sleep/handle function, you could call it from a debug hook.