AndroMeta  2.0.0
Public Member Functions | Friends
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:
threadsThe initial and maximum number of threads this task shall use.
Meta::MProcTask::MProcTask ( size_t  startThreads,
size_t  maxThreads,
long  queueMax = -1 
)

Constructor.

Parameters:
startThreadsThe initial number of threads this task uses.
maxThreadsThe maximum number of threads this task shall grow to as dynamically needed.
queueMaxThe 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.

Destructor. Cleanly shuts down the task.


Member Function Documentation

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

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.

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

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

Stop execution of the task.

Parameters:
clearIf true, clear all queued MProc's.

Halt, clear, and resume the task.

Resume execution of a halted task.

Blocking call to run this task from the main thread.

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::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: