ERC CISST - cisst software

mtsTaskContinuous Class Reference
[Multi Task Support]

#include <mtsTaskContinuous.h>

Inheritance diagram for mtsTaskContinuous:

Inheritance graph
[legend]
Collaboration diagram for mtsTaskContinuous:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class inherits from mtsTask and provides the base for implementing continuous loops, where the user-supplied Run method is repeatedly invoked. It also introduces the possibility to create a new thread or to use an existing thread for the task.

Definition at line 44 of file mtsTaskContinuous.h.

Public Types

Public Member Functions

Protected Member Functions

Protected Attributes

Friends


Constructor & Destructor Documentation

mtsTaskContinuous::mtsTaskContinuous ( const std::string &  name,
unsigned int  sizeStateTable = 256,
bool  newThread = true 
)

Create a task with name 'name' that has a state table of the specified size.

Parameters:
name The name of the task
sizeStateTable The history size of the state table
newThread True if a new thread should be created for this task
Note:
See note in mtsTask regarding length of string name.
If newThread is false, the task will not create a new thread, but will rather "capture" an existing thread. This is done as follows:

1) Call mtsTaskContinuous::Create from the thread to be captured. The class will get the thread id for the current thread and use it to initialize all interfaces in mtsTask::StartupInternal. Once this is done, Create returns to the calling thread.

2) Call mtsTaskContinuous::Start from the thread to be captured. This function captures the thread, and uses it to call the mtsTask::Run method. It does not return until the task is terminated.

Other tasks can use mtsTask::Suspend and mtsTask::Start to suspend and resume this task, or mtsTask::Kill to terminate it. In other words, once started the task should behave the same regardless of whether or not a new thread was created.

Note that mtsTaskFromCallback provides another mechanism for using an existing thread. In that case, the task does not capture the thread, but just registers itself as a callback.

See also:
mtsTask, mtsTaskPeriodic, mtsTaskFromCallback

virtual mtsTaskContinuous::~mtsTaskContinuous (  )  [virtual]

Default Destructor.


Member Function Documentation

virtual void* mtsTaskContinuous::RunInternal ( void *  argument  )  [protected, virtual]

The member function that is passed as 'start routine' argument for thread creation.

Implements mtsTask.

void mtsTaskContinuous::StartInternal ( void   )  [protected]

Called from Start

void mtsTaskContinuous::Start ( void   )  [virtual]

Start/resume execution of the task

Implements mtsTask.

void mtsTaskContinuous::Suspend ( void   )  [virtual]

Suspend the execution of the task

Implements mtsTask.

void mtsTaskContinuous::Kill ( void   )  [virtual]

End the task

Reimplemented from mtsTask.


Member Data Documentation

bool mtsTaskContinuous::NewThread [protected]

True if a new thread should be created for this task.

Definition at line 57 of file mtsTaskContinuous.h.

bool mtsTaskContinuous::CaptureThread [protected]

If a new thread is not created, we need to capture the current thread on the first call to Start.

Definition at line 61 of file mtsTaskContinuous.h.


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu