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

Comparing libcoro/coro.h (file contents):
Revision 1.24 by root, Sun Mar 2 16:10:22 2008 UTC vs.
Revision 1.25 by root, Fri Apr 4 20:07:35 2008 UTC

51 * Use _setjmp instead of setjmp on _XOPEN_SOURCE >= 600. 51 * Use _setjmp instead of setjmp on _XOPEN_SOURCE >= 600.
52 * 2007-05-02 Add assembly versions for x86 and amd64 (to avoid reliance 52 * 2007-05-02 Add assembly versions for x86 and amd64 (to avoid reliance
53 * on SIGUSR2 and sigaltstack in Crossfire). 53 * on SIGUSR2 and sigaltstack in Crossfire).
54 * 2008-01-21 Disable CFI usage on anything but GNU/Linux. 54 * 2008-01-21 Disable CFI usage on anything but GNU/Linux.
55 * 2008-03-02 Switched to 2-clause BSD license with GPL exception. 55 * 2008-03-02 Switched to 2-clause BSD license with GPL exception.
56 * 2008-04-04 New (but highly unrecommended) pthreads backend.
56 */ 57 */
57 58
58#ifndef CORO_H 59#ifndef CORO_H
59#define CORO_H 60#define CORO_H
60 61
103 * 104 *
104 * -DCORO_ASM 105 * -DCORO_ASM
105 * 106 *
106 * Handcoded assembly, known to work only on a few architectures/ABI: 107 * Handcoded assembly, known to work only on a few architectures/ABI:
107 * ELF Linux x86 && amd64 when gcc is used and optimisation is turned on. 108 * ELF Linux x86 && amd64 when gcc is used and optimisation is turned on.
109 *
110 * -DCORO_PTHREAD
111 *
112 * Use the pthread API. You have to provide <pthread.h> and -lpthread.
108 * 113 *
109 * If you define neither of these symbols, coro.h will try to autodetect 114 * If you define neither of these symbols, coro.h will try to autodetect
110 * the model. This currently works for CORO_LOSER only. For the other 115 * the model. This currently works for CORO_LOSER only. For the other
111 * alternatives you should check (e.g. using autoconf) and define the 116 * alternatives you should check (e.g. using autoconf) and define the
112 * following symbols: HAVE_UCONTEXT_H / HAVE_SETJMP_H / HAVE_SIGALTSTACK. 117 * following symbols: HAVE_UCONTEXT_H / HAVE_SETJMP_H / HAVE_SIGALTSTACK.
151 156
152/*****************************************************************************/ 157/*****************************************************************************/
153 158
154#if !defined(CORO_LOSER) && !defined(CORO_UCONTEXT) \ 159#if !defined(CORO_LOSER) && !defined(CORO_UCONTEXT) \
155 && !defined(CORO_SJLJ) && !defined(CORO_LINUX) \ 160 && !defined(CORO_SJLJ) && !defined(CORO_LINUX) \
156 && !defined(CORO_IRIX) && !defined(CORO_ASM) 161 && !defined(CORO_IRIX) && !defined(CORO_ASM) \
162 && !defined(CORO_PTHREAD)
157# if defined(WINDOWS) 163# if defined(WINDOWS)
158# define CORO_LOSER 1 /* you don't win with windoze */ 164# define CORO_LOSER 1 /* you don't win with windoze */
159# elif defined(__linux) && (defined(__x86) || defined (__amd64)) 165# elif defined(__linux) && (defined(__x86) || defined (__amd64))
160# define CORO_ASM 1 166# define CORO_ASM 1
161# elif defined(HAVE_UCONTEXT_H) 167# elif defined(HAVE_UCONTEXT_H)
202struct coro_context { 208struct coro_context {
203 volatile void **sp; 209 volatile void **sp;
204}; 210};
205 211
206void __attribute__ ((__noinline__, __fastcall__)) 212void __attribute__ ((__noinline__, __fastcall__))
207 coro_transfer(coro_context *prev, coro_context *next); 213 coro_transfer (coro_context *prev, coro_context *next);
214
215#elif CORO_PTHREAD
216
217#include <pthread.h>
218
219extern pthread_mutex_t coro_mutex;
220
221struct coro_context {
222 pthread_cond_t c;
223};
224
225void coro_transfer (coro_context *prev, coro_context *next);
208 226
209#endif 227#endif
210 228
211#endif 229#endif
212 230

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines