… | |
… | |
64 | |
64 | |
65 | use Coro::MakeMaker qw(coro_args); |
65 | use Coro::MakeMaker qw(coro_args); |
66 | |
66 | |
67 | # ... set up %args ... |
67 | # ... set up %args ... |
68 | |
68 | |
69 | WriteMakefile(coro_args(%args)); |
69 | WriteMakefile (coro_args (%args)); |
70 | |
70 | |
71 | =head2 XS |
71 | =head2 XS |
72 | |
72 | |
73 | #include "CoroAPI.h" |
73 | #include "CoroAPI.h" |
74 | |
74 | |
75 | BOOT: |
75 | BOOT: |
76 | I_CORO_API("YourModule"); |
76 | I_CORO_API ("YourModule"); |
77 | |
77 | |
78 | =head2 API |
78 | =head2 API |
|
|
79 | |
|
|
80 | This is just a small overview - read the Coro/CoroAPI.h header file in |
|
|
81 | the distribution, and check the examples in F<EV/> and F<Event/*>, or |
|
|
82 | as a more real-world example, the Deliantra game server (which uses |
|
|
83 | Coro::MakeMaker). |
79 | |
84 | |
80 | #define CORO_TRANSFER(prev,next) /* transfer from prev to next */ |
85 | #define CORO_TRANSFER(prev,next) /* transfer from prev to next */ |
81 | #define CORO_SCHEDULE /* like Coro::schedule */ |
86 | #define CORO_SCHEDULE /* like Coro::schedule */ |
82 | #define CORO_CEDE /* like Coro::cede */ |
87 | #define CORO_CEDE /* like Coro::cede */ |
83 | #define CORO_CEDE_NOTSELF /* like Coro::cede_notself */ |
88 | #define CORO_CEDE_NOTSELF /* like Coro::cede_notself */ |
84 | #define CORO_READY(coro) /* like $coro->ready */ |
89 | #define CORO_READY(coro) /* like $coro->ready */ |
85 | #define CORO_IS_READY(coro) /* like $coro->is_ready */ |
90 | #define CORO_IS_READY(coro) /* like $coro->is_ready */ |
86 | #define CORO_NREADY /* # of procs in ready queue */ |
91 | #define CORO_NREADY /* # of procs in ready queue */ |
87 | #define CORO_CURRENT /* returns $Coro::current */ |
92 | #define CORO_CURRENT /* returns $Coro::current */ |
|
|
93 | #define CORO_THROW /* exception pending? */ |
|
|
94 | #define CORO_READYHOOK /* hook for event libs, see Coro::EV */ |
|
|
95 | |
|
|
96 | #define CORO_SV_STATE(coro) /* returns the internal struct coro * */ |
|
|
97 | #define CORO_EXECUTE_SLF(cv,init,ax) /* execute a schedule-like function */ |
|
|
98 | #define CORO_EXECUTE_SLF_XS(init) /* SLF in XS, see e.g. Coro::EV */ |
88 | |
99 | |
89 | =cut |
100 | =cut |