#include <wvcont.h>
Collaboration diagram for WvCont:
Public Types | |
typedef void * | R |
These are hardcoded because I'm too lazy to templatize this. | |
typedef void * | P1 |
typedef WvCallback< R, P1 > | Callback |
Public Member Functions | |
WvCont (const Callback &cb, unsigned long stacksize=64 *1024) | |
Construct a WvCont using an existing WvCallback. | |
WvCont (const WvCont &cb) | |
Copy constructor. | |
~WvCont () | |
Destructor. | |
R | operator() (P1 p1=0) |
call the callback, making p1 the return value of yield() or the parameter to the function, and returning Ret, the argument of yield() or the return value of the function. | |
Static Public Member Functions | |
WvCont | current () |
Get a copy of the current WvCont. | |
P1 | yield (R ret=0) |
"return" from the current callback, giving value 'ret' to the person who called us. | |
bool | isok () |
Tell us if the current context is "okay", that is, not trying to die. |
|
Definition at line 33 of file wvcont.h. Referenced by WvCont(). |
|
|
|
These are hardcoded because I'm too lazy to templatize this. Most people will ignore the return and parameter values anyhow. Definition at line 30 of file wvcont.h. Referenced by operator()(). |
|
Construct a WvCont using an existing WvCallback. The WvCont object can be used in place of that callback, and stored in a callback of the same data type. Definition at line 54 of file wvcont.cc. References Callback. Referenced by current(). |
|
Copy constructor.
Definition at line 47 of file wvcont.cc. References data. |
|
Destructor.
|
|
Get a copy of the current WvCont.
|
|
Tell us if the current context is "okay", that is, not trying to die. If !isok(), you shouldn't yield(), because the caller is just going to keep calling you until you die. Return as soon as you can. |
|
call the callback, making p1 the return value of yield() or the parameter to the function, and returning Ret, the argument of yield() or the return value of the function.
Definition at line 115 of file wvcont.cc. References R. |
|
"return" from the current callback, giving value 'ret' to the person who called us. Next time this callback is called, it's as if yield() had returned, and the parameter to the callback is the value of yield(). Definition at line 140 of file wvcont.cc. References isok(). |