Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2005-06-03 03:40:35


Giovanni P. Deretta wrote:

> Speaking of more Boost centric stuff? There has been any proposal of a
> coroutine library? I think it should definitely be useful and not really
> that hard to implement (fibers on windows and makecontext or the
> setjump/sigaltstack trick on unices). Anyone interested?

IIRC there was an article in C++ user's journal which implemented
coroutines using fibres on windows and threads on unix. I'll have a look
for it later. Also there are these article on fibres (these are the 2nd
and 3rd parts, the first doesn't seem to be available):

http://blogs.msdn.com/oldnewthing/archive/2004/12/30/344281.aspx
http://blogs.msdn.com/oldnewthing/archive/2004/12/31/344799.aspx

Make sure you read the third part - it demonstrates that fibre-safety is
very different to thread safety (similar warning apply to coroutines in
general).

I think setjump would also have some serious problems - you could only
have a single coroutine at a time and it could lead to undefined
behaviour in lots of nasty ways.

Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk