… | |
… | |
37 | |
37 | |
38 | /* |
38 | /* |
39 | * 2006-10-26 Include stddef.h on OS X to work around one of its bugs. |
39 | * 2006-10-26 Include stddef.h on OS X to work around one of its bugs. |
40 | * Reported by Michael_G_Schwern. |
40 | * Reported by Michael_G_Schwern. |
41 | * 2006-11-26 Use _setjmp instead of setjmp on GNU/Linux. |
41 | * 2006-11-26 Use _setjmp instead of setjmp on GNU/Linux. |
|
|
42 | * 2007-04-27 Set unwind frame info if gcc 3+ and ELF is detected. |
|
|
43 | * Use _setjmp instead of setjmp on _XOPEN_SOURCE >= 600. |
42 | */ |
44 | */ |
43 | |
45 | |
44 | #ifndef CORO_H |
46 | #ifndef CORO_H |
45 | #define CORO_H |
47 | #define CORO_H |
46 | |
48 | |
… | |
… | |
171 | |
173 | |
172 | struct coro_context { |
174 | struct coro_context { |
173 | jmp_buf env; |
175 | jmp_buf env; |
174 | }; |
176 | }; |
175 | |
177 | |
176 | #if CORO_LINUX |
178 | #if CORO_LINUX || (_XOPEN_SOURCE >= 600) |
177 | # define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while (0) |
179 | # define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while (0) |
178 | #else |
180 | #else |
179 | # define coro_transfer(p,n) do { if (!setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0) |
181 | # define coro_transfer(p,n) do { if (!setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0) |
180 | #endif |
182 | #endif |
181 | |
183 | |