lua-users home
lua-l archive

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

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...)