[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Any suggestion for a robust C coroutine library which can be used with LuaJIT ?
- From: William Ahern <william@...>
- Date: Thu, 12 Jan 2012 18:32:51 -0800
On Thu, Jan 12, 2012 at 04:52:20PM -0800, Joseph Stewart wrote:
> Maybe this is too much but I've enjoyed messing with "libtask":
>
> http://swtch.com/libtask/
>
> I've used this in conjunction with lua for some non-serious tinkering.
> You'd get channels and some networking code with this too. I believe Zed
> Shaw uses pieces of libtask (not my code) in his Mongrel2 server.
>
It, too, uses makecontext(3), swapcontext(3), et al. In fact, all of the
alternatives given on the list do, AFAICT, because it's the obvious and
correct way to do it. However, notwithstanding the prevalence of the
interfaces (*BSD, Linux, and OS X all have them) they've been removed from
POSIX because all the vendors have abandoned them. The vendors haven't put
any effort into making them play well with POSIX threads; in particular,
apparently, thread local storage.
As long as you're not linking with pthreads, all of the alternatives will be
equally "robust", lightweight, or what have you. The only differences are
the appeal of their APIs.