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

Comparing libcoro/coro.h (file contents):
Revision 1.10 by root, Mon Mar 21 14:38:14 2005 UTC vs.
Revision 1.11 by root, Sat Aug 20 01:03:31 2005 UTC

36 */ 36 */
37 37
38#ifndef CORO_H 38#ifndef CORO_H
39#define CORO_H 39#define CORO_H
40 40
41#define CORO_VERSION 1 41#define CORO_VERSION 2
42
43/*
44 * Changes since API version 1:
45 * replaced bogus -DCORO_LOOSE with gramattically more correct -DCORO_LOSER
46 */
42 47
43/* 48/*
44 * This library consists of only three files 49 * This library consists of only three files
45 * coro.h, coro.c and LICENSE (and optionally README) 50 * coro.h, coro.c and LICENSE (and optionally README)
46 * 51 *
66 * -DCORO_LINUX 71 * -DCORO_LINUX
67 * 72 *
68 * Old GNU/Linux systems (<= glibc-2.1) work with this implementation 73 * Old GNU/Linux systems (<= glibc-2.1) work with this implementation
69 * (very fast). 74 * (very fast).
70 * 75 *
71 * -DCORO_LOOSE 76 * -DCORO_LOSER
72 * 77 *
73 * Microsoft's highly proprietary platform doesn't support sigaltstack, and 78 * Microsoft's highly proprietary platform doesn't support sigaltstack, and
74 * this automatically selects a suitable workaround for this platform. 79 * this automatically selects a suitable workaround for this platform.
75 * (untested) 80 * (untested)
76 * 81 *
77 * -DCORO_IRIX 82 * -DCORO_IRIX
78 * 83 *
79 * SGI's version of Microsoft's NT ;) 84 * SGI's version of Microsoft's NT ;)
80 * 85 *
81 * If you define neither of these symbols, coro.h will try to autodetect 86 * If you define neither of these symbols, coro.h will try to autodetect
82 * the model. This currently works for CORO_LOOSE only. For the other 87 * the model. This currently works for CORO_LOSER only. For the other
83 * alternatives you should check (e.g. using autoconf) and define the 88 * alternatives you should check (e.g. using autoconf) and define the
84 * following symbols: HAVE_UCONTEXT_H / HAVE_SETJMP_H / HAVE_SIGALTSTACK. 89 * following symbols: HAVE_UCONTEXT_H / HAVE_SETJMP_H / HAVE_SIGALTSTACK.
85 */ 90 */
86 91
87/* 92/*
119 * That was it. No other user-visible functions are implemented here. 124 * That was it. No other user-visible functions are implemented here.
120 */ 125 */
121 126
122/*****************************************************************************/ 127/*****************************************************************************/
123 128
124#if !defined(CORO_LOOSE) && !defined(CORO_UCONTEXT) \ 129#if !defined(CORO_LOSER) && !defined(CORO_UCONTEXT) \
125 && !defined(CORO_SJLJ) && !defined(CORO_LINUX) \ 130 && !defined(CORO_SJLJ) && !defined(CORO_LINUX) \
126 && !defined(CORO_IRIX) 131 && !defined(CORO_IRIX)
127# if defined(WINDOWS) 132# if defined(WINDOWS)
128# define CORO_LOOSE 1 /* you don't win with windoze */ 133# define CORO_LOSER 1 /* you don't win with windoze */
129# elif defined(__linux) && defined(__x86) 134# elif defined(__linux) && defined(__x86)
130# elif defined(HAVE_UCONTEXT_H) 135# elif defined(HAVE_UCONTEXT_H)
131# define CORO_UCONTEXT 1 136# define CORO_UCONTEXT 1
132# elif defined(HAVE_SETJMP_H) && defined(HAVE_SIGALTSTACK) 137# elif defined(HAVE_SETJMP_H) && defined(HAVE_SIGALTSTACK)
133# define CORO_SJLJ 1 138# define CORO_SJLJ 1
146 ucontext_t uc; 151 ucontext_t uc;
147}; 152};
148 153
149#define coro_transfer(p,n) swapcontext (&((p)->uc), &((n)->uc)) 154#define coro_transfer(p,n) swapcontext (&((p)->uc), &((n)->uc))
150 155
151#elif CORO_SJLJ || CORO_LOOSE || CORO_LINUX || CORO_IRIX 156#elif CORO_SJLJ || CORO_LOSER || CORO_LINUX || CORO_IRIX
152 157
153#if defined(CORO_LINUX) && !defined(_GNU_SOURCE) 158#if defined(CORO_LINUX) && !defined(_GNU_SOURCE)
154# define _GNU_SOURCE // for linux libc 159# define _GNU_SOURCE // for linux libc
155#endif 160#endif
156 161

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines