Meta::MProcTask Class Reference

Manages thread pooling and queueing to support a group of MProc's running a specific task. More...

#include <MProcTask.h>

List of all members.

Public Member Functions

 MProcTask (size_t threads)
 MProcTask (size_t startThreads, size_t maxThreads, long queueMax=-1)
 ~MProcTask ()
void run ()
void run (const mtime &timeout)
size_t currentThreads () const
void halt (bool clear=false)
void resume ()
void reset ()
void setMinPriority (double priority)
void clearMinPriority ()
void await ()
bool await (const mtime &timeout)

Friends

class MProcTask_

Detailed Description

Manages thread pooling and queueing to support a group of MProc's running a specific task.


Constructor & Destructor Documentation

Meta::MProcTask::MProcTask ( size_t  threads  ) 

Constructor.

Parameters:
threads The initial and maximum number of threads this task shall use.
Meta::MProcTask::MProcTask ( size_t  startThreads,
size_t  maxThreads,
long  queueMax = -1 
)

Constructor.

Parameters:
startThreads The initial number of threads this task uses.
maxThreads The maximum number of threads this task shall grow to as dynamically needed.
queueMax The maximum number of MProc's that may be queued simultaneously or -1 for no limit. When the limit is reached, items at the end of the priority queue are deleted.
Meta::MProcTask::~MProcTask (  ) 

Destructor. Cleanly shuts down the task.


Member Function Documentation

bool Meta::MProcTask::await ( const mtime timeout  ) 

Semi-blocking call that waits for all queued MProc's in this task to finish running, or for timeout to be reached.

Returns:
true on success, i.e: did not timeout.
void Meta::MProcTask::await (  ) 

Blocking call that waits for all queued MProc's in this task to finish running.

void Meta::MProcTask::clearMinPriority (  ) 

Clear the minimum priority that was set by setMinPriority().

size_t Meta::MProcTask::currentThreads (  )  const
Returns:
The number of threads this task is currently using.
void Meta::MProcTask::halt ( bool  clear = false  ) 

Stop execution of the task.

Parameters:
clear If true, clear all queued MProc's.
void Meta::MProcTask::reset (  ) 

Halt, clear, and resume the task.

void Meta::MProcTask::resume (  ) 

Resume execution of a halted task.

void Meta::MProcTask::run ( const mtime timeout  ) 

Semi-blocking call to run the task from the main thread for a specified period of time.

void Meta::MProcTask::run (  ) 

Blocking call to run this task from the main thread.

void Meta::MProcTask::setMinPriority ( double  priority  ) 

Set the minimum priority of queued MProc's this task shall process.


The documentation for this class was generated from the following file:

Generated on Wed Mar 24 16:22:43 2010 for AndroMeta by  doxygen 1.6.1