[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: kill coroutine
- From: Rici Lake <lua@...>
- Date: Sat, 20 Aug 2005 19:13:14 -0500
On 20-Aug-05, at 7:00 PM, Brent Arias wrote:
To stop a lua coroutine, the documentation only mentions yield() ...
return from the main coroutine function. But I would like the ability
externally stop or terminate a coroutine. For example, if I simply
coroutine variable to nil, will Lua understand to kill the coroutine
(regardless if it is yielded or not) and clean up its stack, all in a
Most likely I will attempt this "kill" from C++ rather than from
But knowing how to address this from lua or C++ would be helpful.
When the last reference to the thread (coroutine) disappears, the
garbage collector will take care of it.
By the way, threads are left in a graceful state by yield. (Almost)
nothing needs to be done to them aside from freeing the storage they
occupy (their stack and their callinfo stack).