lua-users home
lua-l archive

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


on 8/18/06 12:12 PM, Roberto Ierusalimschy at roberto@inf.puc-rio.br wrote:

>>> If a thread returns from lua_resume()--not by yielding--but I've stored
>>> the thread in the registry to prevent garbage collection, can I re-issue
>>> lua_resume() rather than creating a new thread?
>> 
>> Can you? yes I have done this. It seems to work unless and
>> exception has been thrown.
>> Are you supposed to? I dont know.
> 
> No problem. Once you clear the returned values from the stack, the
> thread is as good as a new one. In case of errors, it does not unwind
> the stack (so you can inspect it for debugging), and so you cannot reuse
> the thread (as you said). (Maybe we will add a "reset" call to clear the
> thread after an error...)

A reset call would be really useful. We try to cache threads, but we have to
assume that they are invalid after an error.

Mark