… | |
… | |
232 | struct coro_context { |
232 | struct coro_context { |
233 | jmp_buf env; |
233 | jmp_buf env; |
234 | }; |
234 | }; |
235 | |
235 | |
236 | # if _XOPEN_UNIX > 0 |
236 | # if _XOPEN_UNIX > 0 |
237 | # define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while (0) |
237 | # define coro_transfer(p,n) do { if (! _setjmp ((p)->env )) _longjmp ((n)->env, 1); } while (0) |
|
|
238 | # elif CORO_LOSER |
|
|
239 | # define coro_transfer(p,n) do { if (! setjmp ((p)->env )) longjmp ((n)->env, 1); } while (0) |
238 | # else |
240 | # else |
239 | # define coro_transfer(p,n) do { if (! setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0) |
241 | # define coro_transfer(p,n) do { if (!sigsetjmp ((p)->env, 0)) siglongjmp ((n)->env, 1); } while (0) |
240 | # endif |
242 | # endif |
241 | |
243 | |
242 | # define coro_destroy(ctx) (void *)(ctx) |
244 | # define coro_destroy(ctx) (void *)(ctx) |
243 | |
245 | |
244 | #elif CORO_ASM |
246 | #elif CORO_ASM |
245 | |
247 | |
246 | struct coro_context { |
248 | struct coro_context { |
247 | volatile void **sp; /* must be at offset 0 */ |
249 | void **sp; /* must be at offset 0 */ |
248 | }; |
250 | }; |
249 | |
251 | |
250 | void __attribute__ ((__noinline__, __regparm__(2))) |
252 | void __attribute__ ((__noinline__, __regparm__(2))) |
251 | coro_transfer (coro_context *prev, coro_context *next); |
253 | coro_transfer (coro_context *prev, coro_context *next); |
252 | |
254 | |