--- libcoro/coro.h 2008/11/08 04:31:28 1.33 +++ libcoro/coro.h 2008/11/08 13:53:27 1.36 @@ -227,16 +227,28 @@ # include # endif +/* solaris is hopelessly borked, it expands _XOPEN_UNIX to nothing */ +# if __sun +# undef _XOPEN_UNIX +# define _XOPEN_UNIX 1 +# endif + # include struct coro_context { +#if _XOPEN_UNIX > 0 || CORO_LOSER jmp_buf env; +#else + sigjmp_buf env; +#endif }; # if _XOPEN_UNIX > 0 -# define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while (0) +# define coro_transfer(p,n) do { if (! _setjmp ((p)->env )) _longjmp ((n)->env, 1); } while (0) +# elif CORO_LOSER +# define coro_transfer(p,n) do { if (! setjmp ((p)->env )) longjmp ((n)->env, 1); } while (0) # else -# define coro_transfer(p,n) do { if (! setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0) +# define coro_transfer(p,n) do { if (!sigsetjmp ((p)->env, 0)) siglongjmp ((n)->env, 1); } while (0) # endif # define coro_destroy(ctx) (void *)(ctx) @@ -244,7 +256,7 @@ #elif CORO_ASM struct coro_context { - volatile void **sp; /* must be at offset 0 */ + void **sp; /* must be at offset 0 */ }; void __attribute__ ((__noinline__, __regparm__(2)))