[PATCH] Use libpcl for portable coroutines

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri May 15 09:52:06 GMT 2009

On Fri, May 15, 2009 at 10:35:42AM +0100, Sam Liddicott wrote:
> The risk seems to be in ensuring that the creator stack isn't activated
> before the thing it waits on is complete - or that it can tell if this
> occurs and switches to co_main to await the official callback.

If I am not completely mistaken, this is the main problem
when naively applying co-routines to solve problems with the
nested event loops. From my point of view they don't really
solve the fundamental problem I have with them: You call
something you do not know is blocking/nested event/yielding.
After that innocent call you can not rely on *anything*
being the same as you left it before the call, anything
might have happened in between.

This is really threaded programming without mutexes.

Coroutines do have their place in making it easier to
convert existing sync code to async, you don't have to split
the routines up into separate functions. But the caller of
such a converted routine *must* be made aware that it is
calling an async routine, otherwise you would end up with
the same mess you started out to solve.

Just my 2 ct.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090515/d52ff98a/attachment-0001.bin

More information about the samba-technical mailing list