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

Comparing Coro/Coro/CoroAPI.h (file contents):
Revision 1.8 by root, Sun Nov 26 02:16:19 2006 UTC vs.
Revision 1.9 by root, Thu Nov 30 18:21:14 2006 UTC

19 19
20#define TRANSFER_SAVE_ALL ( TRANSFER_SAVE_DEFAV \ 20#define TRANSFER_SAVE_ALL ( TRANSFER_SAVE_DEFAV \
21 | TRANSFER_SAVE_DEFSV \ 21 | TRANSFER_SAVE_DEFSV \
22 | TRANSFER_SAVE_ERRSV ) 22 | TRANSFER_SAVE_ERRSV )
23 23
24struct coro; /* opaque */ 24/*struct coro;*/ /* opaque */
25 25
26struct CoroAPI { 26struct CoroAPI {
27 I32 ver; 27 I32 ver;
28#define CORO_API_VERSION 1 28#define CORO_API_VERSION 2
29#define CORO_API_REVISION 0
29 30
30 /* internal */ 31 /* internal */
31 /*struct coro *(*sv_to_coro)(SV *arg, const char *funcname, const char *varname);*/ 32 /*struct coro *(*sv_to_coro)(SV *arg, const char *funcname, const char *varname);*/
32 33
33 /* public, state */ 34 /* public, state */
34 void (*transfer)(SV *prev, SV *next, int flags); 35 void (*transfer) (SV *prev, SV *next, int flags);
35 36
36 /* public, coro */ 37 /* public, coro */
37 void (*schedule)(void); 38 void (*schedule) (void);
38 void (*cede)(void); 39 void (*cede) (void);
39 void (*ready)(SV *sv); 40 int (*ready) (SV *coro_sv);
41 int (*is_ready) (SV *coro_sv);
40 int *nready; 42 int *nready;
41 GV *current; 43 GV *current;
42}; 44};
43 45
44static struct CoroAPI *GCoroAPI; 46static struct CoroAPI *GCoroAPI;
45 47
46#define CORO_TRANSFER(prev,next,flags) GCoroAPI->transfer(aTHX_ (prev), (next), (flags)) 48#define CORO_TRANSFER(prev,next,flags) GCoroAPI->transfer (aTHX_ (prev), (next), (flags))
47#define CORO_SCHEDULE GCoroAPI->schedule () 49#define CORO_SCHEDULE GCoroAPI->schedule ()
48#define CORO_CEDE GCoroAPI->cede () 50#define CORO_CEDE GCoroAPI->cede ()
49#define CORO_READY(coro) GCoroAPI->ready (coro) 51#define CORO_READY(coro) GCoroAPI->ready (coro)
52#define CORO_IS_READY(coro) GCoroAPI->is_ready (coro)
50#define CORO_NREADY (*GCoroAPI->nready) 53#define CORO_NREADY (*GCoroAPI->nready)
51#define CORO_CURRENT SvRV(GvSV(GCoroAPI->current)) 54#define CORO_CURRENT SvRV (GvSV (GCoroAPI->current))
52 55
53#define I_CORO_API(YourName) \ 56#define I_CORO_API(YourName) \
54STMT_START { \ 57STMT_START { \
55 SV *sv = perl_get_sv("Coro::API",0); \ 58 SV *sv = perl_get_sv("Coro::API",0); \
56 if (!sv) croak("Coro::API not found"); \ 59 if (!sv) croak("Coro::API not found"); \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines