[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: abort a lua_newthread from C and re-use its lua_State?
- From: "David Burgess" <dburgess@...>
- Date: Mon, 30 Apr 2007 09:57:04 +1000
Roberto's message was:
from Roberto Ierusalimschy
date Aug 19, 2006 5:12 AM
subject Re: Reusing a Thread
>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...)