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

Comparing libcoro/coro.h (file contents):
Revision 1.4 by root, Tue Jul 24 20:18:12 2001 UTC vs.
Revision 1.5 by root, Mon Sep 3 02:50:18 2001 UTC

71 * 71 *
72 * Microsoft's highly proprietary platform doesn't support sigaltstack, and 72 * Microsoft's highly proprietary platform doesn't support sigaltstack, and
73 * this automatically selects a suitable workaround for this platform. 73 * this automatically selects a suitable workaround for this platform.
74 * (untested) 74 * (untested)
75 * 75 *
76 * -DCORO_IRIX
77 *
78 * SGI's version of Microsoft's NT ;)
79 *
76 * If you define neither of these symbols, coro.h will try to autodetect 80 * If you define neither of these symbols, coro.h will try to autodetect
77 * the model. This currently works for CORO_LOOSE only. For the other 81 * the model. This currently works for CORO_LOOSE only. For the other
78 * alternatives you should check (e.g. using autoconf) and define the 82 * alternatives you should check (e.g. using autoconf) and define the
79 * following symbols: HAVE_UCONTEXT_H / HAVE_SETJMP_H / HAVE_SIGALTSTACK. 83 * following symbols: HAVE_UCONTEXT_H / HAVE_SETJMP_H / HAVE_SIGALTSTACK.
80 */ 84 */
113 117
114/* 118/*
115 * That was it. No other user-visible functions are implemented here. 119 * That was it. No other user-visible functions are implemented here.
116 */ 120 */
117 121
122/*****************************************************************************/
123
118#if !defined(CORO_LOOSE) && !defined(CORO_UCONTEXT) \ 124#if !defined(CORO_LOOSE) && !defined(CORO_UCONTEXT) \
119 && !defined(CORO_SJLJ) && !defined(CORO_LINUX) 125 && !defined(CORO_SJLJ) && !defined(CORO_LINUX) \
126 && !defined(CORO_IRIX)
120# if defined(WINDOWS) 127# if defined(WINDOWS)
121# define CORO_LOOSE 1 /* you don't win with windoze */ 128# define CORO_LOOSE 1 /* you don't win with windoze */
122# elif defined(__linux) && defined(__x86) 129# elif defined(__linux) && defined(__x86)
123# elif defined(HAVE_UCONTEXT_H) 130# elif defined(HAVE_UCONTEXT_H)
124# define CORO_UCONTEXT 1 131# define CORO_UCONTEXT 1
127# else 134# else
128error unknown or unsupported architecture 135error unknown or unsupported architecture
129# endif 136# endif
130#endif 137#endif
131 138
139/*****************************************************************************/
140
132#if CORO_UCONTEXT 141#if CORO_UCONTEXT
133 142
134#include <ucontext.h> 143#include <ucontext.h>
135 144
136struct coro_context { 145struct coro_context {
137 ucontext_t uc; 146 ucontext_t uc;
138}; 147};
139 148
140#define coro_transfer(p,n) swapcontext(&((p)->uc), &((n)->uc)) 149#define coro_transfer(p,n) swapcontext(&((p)->uc), &((n)->uc))
141 150
142#elif CORO_SJLJ || CORO_LOOSE || CORO_LINUX 151#elif CORO_SJLJ || CORO_LOOSE || CORO_LINUX || CORO_IRIX
143 152
144#include <setjmp.h> 153#include <setjmp.h>
145 154
146struct coro_context { 155struct coro_context {
147 jmp_buf env; 156 jmp_buf env;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines