views:

715

answers:

3

I would like to get ahold of a lightweight, portable fiber lib with MIT license (or looser). Boost.Coroutine does not qualify (not lightweight), neither do Portable Coroutine Library nor Kent C++CSP (both GPL).

Edit: could you help me find one? :)

+1  A: 

list of implementations for C

for ultra lightweight "threads" take a look at Protothreads at the bottom of the wikipedia article.

I eventually found http://www.sics.se/~adam/pt/download.html, which looks promising.
Jonas Byström
Prooved to be a switch/case wrapper with implicit state. Not what I was looking for, but still somewhat interesting.
Jonas Byström
+2  A: 
  1. Libtask: MIT License
  2. Libconcurrency: LGPL (a little tighter than MIT, but it's a functional library!)

Both are written for C.

Imagist
Looks like setcontext() / setmcontext() might be some work on certain platforms, but other than that looks readily portable.
Jonas Byström
+1  A: 

I actually blogged about this in the past. Have a look! I hope it answers your questions. In it, I cover a number of libraries, and I was particularly interested in ones that were useful for systems programming (asynchronous IO).

Conspicuously absent from that coverage is Boost.Coroutine, which I'll discuss here. Boost.Coroutine may be considered "heavyweight" conceptually (in terms of its family of types), but the implementation is quite efficient. The real problem is that Boost.Coroutine is incomplete, and (last I checked) far from complete. I had spent some time trying to work with the author through its non-starter issues, as I was really looking forward to using it in conjunction with Boost.Asio (this was one of Boost.Coroutine's primary objectives), but the author has not had the time to take his work to the Boost formal review stage.

Yang