lua-users home
lua-l archive

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


It was thus said that the Great Teto once stated:
> Hi,
> 
> I am looking for a coroutine library that is able to :
> -handle dependancies between coroutines. For instance, a coroutine can
> be a child of another one, if I remove its daddy, it should die. The
> child coroutine could also block the daddy coroutine.

  I think it's a mistake to assume a coroutine can be treated like a thread. 
In Lua, there is no concept of a "parent/child coroutine."  If you want such
a concept, you'll have to wrap the coroutine routines to enforce this
"parent/child" concept.  In none of the codebases where I've used tons of
coroutines have I felt the need for a "parent/child" relationship.

> -reuse these coroutines (I read it could improve performance)

  I think coroutines are lighter than threads, so at this point, I wouldn't
worry too much about it.  

  -spc