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

Comparing libcoro/coro.h (file contents):
Revision 1.32 by root, Fri Nov 7 20:12:26 2008 UTC vs.
Revision 1.33 by root, Sat Nov 8 04:31:28 2008 UTC

60 * 2008-11-05 Hopefully fix misaligned stacks with CORO_ASM/SETJMP. 60 * 2008-11-05 Hopefully fix misaligned stacks with CORO_ASM/SETJMP.
61 * 2008-11-07 rbp wasn't saved in CORO_ASM on x86_64. 61 * 2008-11-07 rbp wasn't saved in CORO_ASM on x86_64.
62 * introduce coro_destroy, which is a nop except for pthreads. 62 * introduce coro_destroy, which is a nop except for pthreads.
63 * speed up CORO_PTHREAD. Do no longer leak threads either. 63 * speed up CORO_PTHREAD. Do no longer leak threads either.
64 * coro_create now allows one to create source coro_contexts. 64 * coro_create now allows one to create source coro_contexts.
65 * do not rely on makecontext passing a void * correctly.
66 * try harder to get _setjmp/_longjmp.
67 * major code cleanup/restructuring.
65 */ 68 */
66 69
67#ifndef CORO_H 70#ifndef CORO_H
68#define CORO_H 71#define CORO_H
69 72
218 221
219# if defined(CORO_LINUX) && !defined(_GNU_SOURCE) 222# if defined(CORO_LINUX) && !defined(_GNU_SOURCE)
220# define _GNU_SOURCE /* for linux libc */ 223# define _GNU_SOURCE /* for linux libc */
221# endif 224# endif
222 225
226# if !CORO_LOSER
227# include <unistd.h>
228# endif
229
223# include <setjmp.h> 230# include <setjmp.h>
224 231
225struct coro_context { 232struct coro_context {
226 jmp_buf env; 233 jmp_buf env;
227}; 234};
228 235
229# if CORO_LINUX || (_XOPEN_SOURCE >= 600) 236# if _XOPEN_UNIX > 0
230# 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)
231# else 238# else
232# define coro_transfer(p,n) do { if (!setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0) 239# define coro_transfer(p,n) do { if (! setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0)
233# endif 240# endif
234 241
235# define coro_destroy(ctx) (void *)(ctx) 242# define coro_destroy(ctx) (void *)(ctx)
236 243
237#elif CORO_ASM 244#elif CORO_ASM

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines