lua-users home
lua-l archive

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


On 19/01/2012 15:20, Joshua Jensen wrote:
----- Original Message -----
From: andre@leiradella.com
Date: 1/18/2012 7:04 AM
Hi All,

I've implemented a scheduler that reuses coroutines. Pretty standard stuff: spawn a new coroutine, yield, sleeping for some time, stop, wait for events.

Stop causes the current coroutine to abort and return itself to the pool of available coroutines, but I need to implement something to kill any arbitrary coroutine.

Is there a way to throw an error in another Lua thread?

Perhaps this patch may help you:

https://github.com/jjensen/luaplus51-all/commit/663f15dc02bf3d6e7678612fca834d2c4f4f3bfd
This does exactly what I want, but I want to use stock Lua. Thanks though.

At the time, it worked for me, but I never ended up using it in production. YMMV.

-Josh