On Fri, May 22, 2009 at 07:38:15PM +0100, James Mansion 
<ja...@mansionfamily.plus.com> wrote:
>> broken implementations, it has never been successfully standardised etc.).
>>   
> Are you sure that the situation is that dismal?
>
> Try also http://www.dekorte.com/projects/opensource/libcoroutine/

absolutely. unlike that guy, i don't compile my software on gnu/linux only
and call it portable :) it would be nice if ucontext functions did work
(ok, they are extremely slow (syscall), but at least they would be hassle-free).

ucontext functions are broken on every bsd, and setjmp/longjmp doesn't
work either on at least netbsd/freebsd. half of the commercial unices
implement it completely wrongly (e.g. funny interpretations for the stack
address), and the other half doesn't implement the functions at all.

this is the reason why they are no longer part of the unix api: they have
never been widely implemented.

> When I was looking for one of these things, it looked clean and  
> suggested reasonable portability. I
> haven't given it a workout though.

well, libcoro is continously being tested on a lot of platforms (I gave
a link), which is why I know that the ucontext functions are about as
portable as fibers.

in fact, the only way to implement coroutines on freebsd and netbsd that I
found is using the native thread library (which on netbsd is only slightly
slower as the ucontetx functions, fortunately, as it's userspace).

not even rolling your own assembly code works on most bsds, as their libcs
either rely on finding some thread control block at the end of the stack or
do stack range checking e.g. in longjmp.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      p...@goof.com
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to