#include <microthread.h>
Inheritance diagram for Microthread:
Public Member Functions | |
virtual void | run ()=0 |
This method is run when the Microthread gets started. | |
void | scheduleme () |
Schedule this Microthread for continuation. | |
void | delayme () |
Discontinues executing this Microthread for now. | |
void | swapto (Microthread &o, bool acquired=false) |
Discontinues executing this Microthread and continue execution of the Microthread o. | |
void | setcallback (Callback *cb) |
Sets a Callback to be executed at the next time this Microthread continues execution. | |
Public Attributes | |
ChannelManager | channelmanager |
Manager object for channels associated with this microthread. | |
Protected Member Functions | |
Microthread (BlockingQueue< Microthread * > *q=NULL) | |
Construct a Microthread running on queue q. | |
void | start () |
Boots the Microthread. | |
Protected Attributes | |
BlockingQueue< Microthread * > & | queue |
The queue to be used with scheduleme(). | |
Friends | |
class | Runner |
Microthread::Microthread | ( | BlockingQueue< Microthread * > * | q = NULL |
) | [protected] |
Construct a Microthread running on queue q.
q | is the queue the Microthread needs to insert itself |
virtual void Microthread::run | ( | ) | [pure virtual] |
This method is run when the Microthread gets started.
It must be overridden by all derived classes.
Implemented in BaseScheduler, EpollScheduler, and SelectScheduler.
void Microthread::scheduleme | ( | ) | [inline] |
Schedule this Microthread for continuation.
If this Microthread currently runs it should immediately call .delayme().
void Microthread::delayme | ( | ) |
Discontinues executing this Microthread for now.
It may later be continued by scheduleme() or special swapto() calls.
ThreadExitException |
void Microthread::swapto | ( | Microthread & | o, | |
bool | acquired = false | |||
) |
Discontinues executing this Microthread and continue execution of the Microthread o.
Apart from directly passing control to o this works like delayme().
o | is the Microthread to be continued | |
acquired | the internal lock is not acquired of this is set to true, ignore this if you don't know about internal locks |
ThreadExitException |
void Microthread::setcallback | ( | Callback * | cb | ) |
Sets a Callback to be executed at the next time this Microthread continues execution.
The Callback will be executed within this Microthread and thus may throw exceptions to terminate the Microthread.
cb | is the callback to be executed |
BlockingQueue<Microthread*>& Microthread::queue [protected] |
The queue to be used with scheduleme().
This is internal and should not be used. It is not private because it is used in scheduler implementations.
Manager object for channels associated with this microthread.
It should be passed to the Channel constructor.