Coroutine Class Reference

Internal coroutine interface class. More...

#include <coroutine_decls.h>

Inheritance diagram for Coroutine:

NewCoroutine Runner Microthread BaseScheduler EpollScheduler SelectScheduler List of all members.

Public Member Functions

 Coroutine ()
 Constructs a Coroutine.
void acquire () throw ()
 Acquires this coroutine before a swapto() or returnto() when other datastructures need to be modified.
void release () throw ()
 Releases this coroutine.
void swapto (Coroutine &o, bool acquired=false)
 Swaps the context from this coroutine to the given coroutine.

Protected Member Functions

virtual void destroyme ()
 Internal function return interface.

Protected Attributes

ucontext_t context
 Internal context datastructure.

Friends

class NewCoroutine

Detailed Description

Internal coroutine interface class.


Constructor & Destructor Documentation

Coroutine::Coroutine (  ) 

Constructs a Coroutine.

Note that the calling thread must invoke the acquire method prior using the coroutine with swapto.


Member Function Documentation

void Coroutine::destroyme (  )  [protected, virtual]

Internal function return interface.

Do not use.

void Coroutine::acquire (  )  throw () [inline]

Acquires this coroutine before a swapto() or returnto() when other datastructures need to be modified.

The acquired parameter of the next swapto() or returnto() must be true.

void Coroutine::release (  )  throw () [inline]

Releases this coroutine.

This method must be called before destructing a Coroutine, but after having ensured that noone else modifies it.

void Coroutine::swapto ( Coroutine o,
bool  acquired = false 
)

Swaps the context from this coroutine to the given coroutine.

Parameters:
o is the coroutine being swapped to
acquired must be true if this object was previously acquired using acquire()


Member Data Documentation

ucontext_t Coroutine::context [protected]

Internal context datastructure.

It is not private because it is accessed in NewCoroutine.


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 01:26:51 2009 by  doxygen 1.5.1