ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libcoro/coro.h
(Generate patch)

Comparing libcoro/coro.h (file contents):
Revision 1.33 by root, Sat Nov 8 04:31:28 2008 UTC vs.
Revision 1.36 by root, Sat Nov 8 13:53:27 2008 UTC

225 225
226# if !CORO_LOSER 226# if !CORO_LOSER
227# include <unistd.h> 227# include <unistd.h>
228# endif 228# endif
229 229
230/* solaris is hopelessly borked, it expands _XOPEN_UNIX to nothing */
231# if __sun
232# undef _XOPEN_UNIX
233# define _XOPEN_UNIX 1
234# endif
235
230# include <setjmp.h> 236# include <setjmp.h>
231 237
232struct coro_context { 238struct coro_context {
239#if _XOPEN_UNIX > 0 || CORO_LOSER
233 jmp_buf env; 240 jmp_buf env;
241#else
242 sigjmp_buf env;
243#endif
234}; 244};
235 245
236# if _XOPEN_UNIX > 0 246# if _XOPEN_UNIX > 0
237# define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while (0) 247# define coro_transfer(p,n) do { if (! _setjmp ((p)->env )) _longjmp ((n)->env, 1); } while (0)
248# elif CORO_LOSER
249# define coro_transfer(p,n) do { if (! setjmp ((p)->env )) longjmp ((n)->env, 1); } while (0)
238# else 250# else
239# define coro_transfer(p,n) do { if (! setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0) 251# define coro_transfer(p,n) do { if (!sigsetjmp ((p)->env, 0)) siglongjmp ((n)->env, 1); } while (0)
240# endif 252# endif
241 253
242# define coro_destroy(ctx) (void *)(ctx) 254# define coro_destroy(ctx) (void *)(ctx)
243 255
244#elif CORO_ASM 256#elif CORO_ASM
245 257
246struct coro_context { 258struct coro_context {
247 volatile void **sp; /* must be at offset 0 */ 259 void **sp; /* must be at offset 0 */
248}; 260};
249 261
250void __attribute__ ((__noinline__, __regparm__(2))) 262void __attribute__ ((__noinline__, __regparm__(2)))
251coro_transfer (coro_context *prev, coro_context *next); 263coro_transfer (coro_context *prev, coro_context *next);
252 264

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines