lua-users home
lua-l archive

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


On Thu, Mar 23, 2006 at 02:49:42AM -0800, bert wrote:
> But what if one is using an OS API that contains a blocking call,
> and there is no way to specify a timeout? Normally, this would be
> handled by making this blocking call in a thread. I don't see how
> this could be done with coroutines. am I missing something?

No, I think you've got it.  Coroutines are cooperative, so if a system
call within a coroutine blocks, it will prevent the coroutine from
yielding and therefore block the entire program until the system call
returns.  You'll need to use threads if you want code to continue
running while part of your program is blocked.

                                                  -Dave Dodge