ldas-tools-al 2.6.7
Loading...
Searching...
No Matches
TaskThread Class Reference

#include <TaskThread.hh>

Inheritance diagram for TaskThread:
Collaboration diagram for TaskThread:

Public Types

enum  state_type {
  TASK_THREAD_NOT_STARTED , TASK_THREAD_SLEEPING , TASK_THREAD_RUNNING , TASK_THREAD_TIMEDOUT ,
  TASK_THREAD_FINISHED , TASK_THREAD_EXITING , TASK_THREAD_NOT_STARTED , TASK_THREAD_SLEEPING ,
  TASK_THREAD_RUNNING , TASK_THREAD_TIMEDOUT , TASK_THREAD_FINISHED , TASK_THREAD_EXITING
}
enum  state_type {
  TASK_THREAD_NOT_STARTED , TASK_THREAD_SLEEPING , TASK_THREAD_RUNNING , TASK_THREAD_TIMEDOUT ,
  TASK_THREAD_FINISHED , TASK_THREAD_EXITING , TASK_THREAD_NOT_STARTED , TASK_THREAD_SLEEPING ,
  TASK_THREAD_RUNNING , TASK_THREAD_TIMEDOUT , TASK_THREAD_FINISHED , TASK_THREAD_EXITING
}
typedef Thread::cancel_type cancel_method
typedef Thread::cancel_type cancel_method
typedef Thread::signal_type task_signal_type
typedef Thread::signal_type task_signal_type
enum  cancel_type {
  CANCEL_ABANDON , CANCEL_IGNORE , CANCEL_ASYNCHRONOUS , CANCEL_DEFERRED ,
  CANCEL_EXCEPTION , CANCEL_BY_SIGNAL , CANCEL_UNKNOWN , CANCEL_ABANDON ,
  CANCEL_IGNORE , CANCEL_ASYNCHRONOUS , CANCEL_DEFERRED , CANCEL_EXCEPTION ,
  CANCEL_BY_SIGNAL , CANCEL_UNKNOWN
}
enum  cancel_type {
  CANCEL_ABANDON , CANCEL_IGNORE , CANCEL_ASYNCHRONOUS , CANCEL_DEFERRED ,
  CANCEL_EXCEPTION , CANCEL_BY_SIGNAL , CANCEL_UNKNOWN , CANCEL_ABANDON ,
  CANCEL_IGNORE , CANCEL_ASYNCHRONOUS , CANCEL_DEFERRED , CANCEL_EXCEPTION ,
  CANCEL_BY_SIGNAL , CANCEL_UNKNOWN
}
typedef SignalHandler::signal_type signal_type
typedef SignalHandler::signal_type signal_type
typedef void(* cleanup_function_type) (void *)
typedef void(* cleanup_function_type) (void *)

Public Member Functions

 TaskThread ()
 TaskThread ()
virtual ~TaskThread ()
virtual ~TaskThread ()
void AddTask (Task &TaskToDo)
void AddTask (Task *TaskToDo)
void AddTask (Task &TaskToDo)
void AddTask (Task *TaskToDo)
void CriticalSection (bool)
void CriticalSection (bool)
bool Halt ()
bool Halt ()
MutexLock::baton_type Mutex ()
MutexLock::baton_type Mutex ()
enum state_type State () const
enum state_type State () const
bool TimedOut ()
bool TimedOut ()
void TimedWait (int Seconds)
void TimedWait (int Seconds)
void Wait ()
void Wait ()
const char * Type () const
const char * Type () const
Task::name_type Name () const
Task::name_type Name () const
virtual void Cancel ()
virtual void Cancel ()
void CancellationCheck (const std::string &Header, const char *File, const int Line) const
 Deliver pending cancellation requests to the calling thread.
void CancellationCheck (const std::string &Header, const char *File, const int Line) const
 Deliver pending cancellation requests to the calling thread.
void CancellationEnable (bool Value)
void CancellationEnable (bool Value)
cancel_type CancellationType (signal_type &Signal) const
 Return the type of cancellation.
void CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN)
 Establiosh the type of cancellation.
cancel_type CancellationType (signal_type &Signal) const
 Return the type of cancellation.
void CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN)
 Establiosh the type of cancellation.
void Detach () const
void Detach () const
virtual void Join ()
virtual void Join ()
bool IsAlive () const
bool IsAlive () const
bool IsCancelled () const
 Return the cancellation state of the thread.
bool IsCancelled () const
 Return the cancellation state of the thread.
bool IsDetached () const
 Reports detached state.
bool IsDetached () const
 Reports detached state.
bool IsParentThread () const
bool IsParentThread () const
int Kill (signal_type Signal) const
int Kill (signal_type Signal) const
thread_type ParentThread () const
 Retrieve key for parent thread.
thread_type ParentThread () const
 Retrieve key for parent thread.
virtual int Spawn ()
virtual int Spawn ()
void SignalCapture (signal_type Sig)
void SignalCapture (signal_type Sig)
void SignalIgnore (signal_type Sig)
void SignalIgnore (signal_type Sig)
bool operator== (const Thread &Source) const
bool operator== (const Thread &Source) const

Static Public Member Functions

static std::string StateStr (enum state_type Value)
static std::string StateStr (enum state_type Value)
static void SelfCancellationCheck (const std::string &Header, const char *File, const int Line)
static void SelfCancellationCheck (const std::string &Header, const char *File, const int Line)
static size_t StackSizeDefault ()
static void StackSizeDefault (size_t StackSize)
static size_t StackSizeDefault ()
static void StackSizeDefault (size_t StackSize)

Protected Types

typedef void *(* start_function_type) (void *)
typedef void *(* start_function_type) (void *)

Protected Member Functions

int spawn (start_function_type StartFunction=(start_function_type) start_routine)
 Spawn a new thread.
int spawn (start_function_type StartFunction=(start_function_type) start_routine)
 Spawn a new thread.
thread_type threadId () const
thread_type threadId () const

Static Protected Member Functions

static void cancelCleanup (Thread *Source)
 Perform cleanup of a cancelled thread.
static void cancelCleanup (Thread *Source)
 Perform cleanup of a cancelled thread.

Private Member Functions

 TaskThread (const TaskThread &Source)
 TaskThread (const TaskThread &Source)
virtual void action ()
virtual void action ()
 Job to be acomplished by the thread.
TaskThreadoperator= (const TaskThread &Source)
TaskThreadoperator= (const TaskThread &Source)
void cancellation_enable (bool Value)
void cancellation_enable (bool Value)
void set_cancelled_state ()
void set_cancelled_state ()

Static Private Member Functions

static Threadstart_routine (Thread *ThreadSource)
static Threadstart_routine (Thread *ThreadSource)

Private Attributes

bool m_done
ConditionalVariable m_task_available
Taskm_task
const char * m_task_type_name
Task::name_type task_name
cancel_method m_cancel_method
task_signal_type m_cancel_signal
state_type m_state
boost::shared_ptr< impl > p
signal_type m_cancel_via_signal
 Signal to use for cancelation.
bool m_cancel_state
 Enable or disable the cancellability of a thread.
bool m_cancel_thread
 Conditional state of thread being cancelled.
cancel_type m_cancellation_type
 Method used for thread cancellation.
bool detached
 State of detached.

Member Typedef Documentation

◆ cancel_method [1/2]

◆ cancel_method [2/2]

◆ cleanup_function_type [1/2]

typedef void(* LDASTools::AL::Thread::cleanup_function_type) (void *)
inherited

◆ cleanup_function_type [2/2]

typedef void(* LDASTools::AL::Thread::cleanup_function_type) (void *)
inherited

◆ signal_type [1/2]

◆ signal_type [2/2]

◆ start_function_type [1/2]

typedef void *(* LDASTools::AL::Thread::start_function_type) (void *)
protectedinherited

◆ start_function_type [2/2]

typedef void *(* LDASTools::AL::Thread::start_function_type) (void *)
protectedinherited

◆ task_signal_type [1/2]

◆ task_signal_type [2/2]

Member Enumeration Documentation

◆ cancel_type [1/2]

Enumerator
CANCEL_ABANDON 
CANCEL_IGNORE 
CANCEL_ASYNCHRONOUS 
CANCEL_DEFERRED 
CANCEL_EXCEPTION 
CANCEL_BY_SIGNAL 
CANCEL_UNKNOWN 
CANCEL_ABANDON 
CANCEL_IGNORE 
CANCEL_ASYNCHRONOUS 
CANCEL_DEFERRED 
CANCEL_EXCEPTION 
CANCEL_BY_SIGNAL 
CANCEL_UNKNOWN 

◆ cancel_type [2/2]

Enumerator
CANCEL_ABANDON 
CANCEL_IGNORE 
CANCEL_ASYNCHRONOUS 
CANCEL_DEFERRED 
CANCEL_EXCEPTION 
CANCEL_BY_SIGNAL 
CANCEL_UNKNOWN 
CANCEL_ABANDON 
CANCEL_IGNORE 
CANCEL_ASYNCHRONOUS 
CANCEL_DEFERRED 
CANCEL_EXCEPTION 
CANCEL_BY_SIGNAL 
CANCEL_UNKNOWN 

◆ state_type [1/2]

Enumerator
TASK_THREAD_NOT_STARTED 
TASK_THREAD_SLEEPING 
TASK_THREAD_RUNNING 
TASK_THREAD_TIMEDOUT 
TASK_THREAD_FINISHED 
TASK_THREAD_EXITING 
TASK_THREAD_NOT_STARTED 
TASK_THREAD_SLEEPING 
TASK_THREAD_RUNNING 
TASK_THREAD_TIMEDOUT 
TASK_THREAD_FINISHED 
TASK_THREAD_EXITING 

◆ state_type [2/2]

Enumerator
TASK_THREAD_NOT_STARTED 
TASK_THREAD_SLEEPING 
TASK_THREAD_RUNNING 
TASK_THREAD_TIMEDOUT 
TASK_THREAD_FINISHED 
TASK_THREAD_EXITING 
TASK_THREAD_NOT_STARTED 
TASK_THREAD_SLEEPING 
TASK_THREAD_RUNNING 
TASK_THREAD_TIMEDOUT 
TASK_THREAD_FINISHED 
TASK_THREAD_EXITING 

Constructor & Destructor Documentation

◆ TaskThread() [1/4]

◆ TaskThread() [2/4]

◆ TaskThread() [3/4]

◆ TaskThread() [4/4]

◆ ~TaskThread() [1/2]

◆ ~TaskThread() [2/2]

Member Function Documentation

◆ action() [1/2]

void LDASTools::AL::TaskThread::action ( )
privatevirtual

This method does the work of the thread and runs in the conrtolled thread. It does a task and then waits for another task. This allows for the thread to be reused.

Implements LDASTools::AL::Thread.

◆ action() [2/2]

virtual void LDASTools::AL::TaskThread::action ( )
privatevirtual

Job to be acomplished by the thread.

Implements LDASTools::AL::Thread.

◆ AddTask() [1/4]

void LDASTools::AL::TaskThread::AddTask ( Task & TaskToDo)
inline

◆ AddTask() [2/4]

◆ AddTask() [3/4]

◆ AddTask() [4/4]

◆ Cancel() [1/2]

void LDASTools::AL::Thread::Cancel ( )
virtualinherited

◆ Cancel() [2/2]

virtual void LDASTools::AL::Thread::Cancel ( )
virtualinherited

◆ cancelCleanup() [1/2]

void LDASTools::AL::Thread::cancelCleanup ( Thread * Source)
staticprotectedinherited

Perform cleanup of a cancelled thread.

Parameters
[in]SourceThe thread being cancelled.

◆ cancelCleanup() [2/2]

void LDASTools::AL::Thread::cancelCleanup ( Thread * Source)
staticprotectedinherited

Perform cleanup of a cancelled thread.

Parameters
[in]SourceThe thread being cancelled.

◆ cancellation_enable() [1/2]

void LDASTools::AL::Thread::cancellation_enable ( bool Value)
privateinherited

Establish the cancellability of a thread. If a Value of true is passed, then the thread will allow cancellation as determined by the call to CancellationType.

Note
This call must only be made by a child thread.
See also
CancellationType

◆ cancellation_enable() [2/2]

void LDASTools::AL::Thread::cancellation_enable ( bool Value)
privateinherited

◆ CancellationCheck() [1/2]

void LDASTools::AL::Thread::CancellationCheck ( const std::string & Header,
const char * File,
const int Line ) const
inherited

Deliver pending cancellation requests to the calling thread.

Parameters
[in]HeaderDescription of the method from which the request was made
[in]FileFilename from where the request was made.
[in]LineLine number in Filename from where the request was made.

Deliver any pending cancellation requests to the calling thread. If cancellation is to be done via exception, then a cancellation exception is throw. If not, then a call to the appropriate thread library's cancellation routine is made.

Note
This call must only be made by a child thread.

◆ CancellationCheck() [2/2]

void LDASTools::AL::Thread::CancellationCheck ( const std::string & Header,
const char * File,
const int Line ) const
inherited

Deliver pending cancellation requests to the calling thread.

Parameters
[in]HeaderDescription of the method from which the request was made
[in]FileFilename from where the request was made.
[in]LineLine number in Filename from where the request was made.

◆ CancellationEnable() [1/2]

void LDASTools::AL::Thread::CancellationEnable ( bool Value)
inherited

◆ CancellationEnable() [2/2]

void LDASTools::AL::Thread::CancellationEnable ( bool Value)
inherited

◆ CancellationType() [1/4]

void LDASTools::AL::Thread::CancellationType ( cancel_type Type,
signal_type Signal = SignalHandler::SIGNAL_UNKNOWN )
inherited

Establiosh the type of cancellation.

Parameters
[in]TypeThe type of cancellation.
[in]SignalAny auxiliary information associated with the cancellation type.

Sets a how a thread can be cancelled.

  • CANCEL_ASYNCHRONOUS A cancellation request is immediated delivered to the thread.
  • CANCEL_DEFERRED A cancellation request is marked pending for the thread and the thread is cancelled when it gets to a system cancellation point or when CancellationCheck is called.
  • CANCEL_EXCEPTION A cancellation request is marked pending for the thread and the thread throws a cancellation exception upon calling CancellationCheck.
Note
This call must only be made by a chivld thread.
See also
CancellationEnable, CancellationCheck

◆ CancellationType() [2/4]

void LDASTools::AL::Thread::CancellationType ( cancel_type Type,
signal_type Signal = SignalHandler::SIGNAL_UNKNOWN )
inherited

Establiosh the type of cancellation.

Parameters
[in]TypeThe type of cancellation.
[in]SignalAny auxiliary information associated with the cancellation type.

◆ CancellationType() [3/4]

Thread::cancel_type LDASTools::AL::Thread::CancellationType ( signal_type & Signal) const
inherited

Return the type of cancellation.

Parameters
[out]SignalAny auxiliary information associated with the cancellation type
Returns
The type of cancellation.
See also
cancel_type

◆ CancellationType() [4/4]

cancel_type LDASTools::AL::Thread::CancellationType ( signal_type & Signal) const
inherited

Return the type of cancellation.

Parameters
[out]SignalAny auxiliary information associated with the cancellation type
Returns
The type of cancellation.
See also
cancel_type

◆ CriticalSection() [1/2]

void LDASTools::AL::TaskThread::CriticalSection ( bool IsCriticalSection)

◆ CriticalSection() [2/2]

◆ Detach() [1/2]

void LDASTools::AL::Thread::Detach ( ) const
inherited

◆ Detach() [2/2]

void LDASTools::AL::Thread::Detach ( ) const
inherited

◆ Halt() [1/2]

◆ Halt() [2/2]

◆ IsAlive() [1/2]

bool LDASTools::AL::Thread::IsAlive ( ) const
inherited

◆ IsAlive() [2/2]

bool LDASTools::AL::Thread::IsAlive ( ) const
inherited

◆ IsCancelled() [1/2]

bool LDASTools::AL::Thread::IsCancelled ( ) const
inherited

Return the cancellation state of the thread.

Returns
Returns true if the thread has been cancelled, false otherwise.

◆ IsCancelled() [2/2]

bool LDASTools::AL::Thread::IsCancelled ( ) const
inherited

Return the cancellation state of the thread.

Returns
Returns true if the thread has been cancelled, false otherwise.

◆ IsDetached() [1/2]

bool LDASTools::AL::Thread::IsDetached ( ) const
inherited

Reports detached state.

Returns
Returns true if the thread has been detached, false otherwise

◆ IsDetached() [2/2]

bool LDASTools::AL::Thread::IsDetached ( ) const
inherited

Reports detached state.

Returns
Returns true if the thread has been detached, false otherwise

◆ IsParentThread() [1/2]

bool LDASTools::AL::Thread::IsParentThread ( ) const
inherited

◆ IsParentThread() [2/2]

bool LDASTools::AL::Thread::IsParentThread ( ) const
inherited

◆ Join() [1/2]

void LDASTools::AL::Thread::Join ( )
virtualinherited

◆ Join() [2/2]

virtual void LDASTools::AL::Thread::Join ( )
virtualinherited

◆ Kill() [1/2]

int LDASTools::AL::Thread::Kill ( signal_type Signal) const
inherited

◆ Kill() [2/2]

int LDASTools::AL::Thread::Kill ( signal_type Signal) const
inherited

◆ Mutex() [1/2]

◆ Mutex() [2/2]

◆ Name() [1/2]

◆ Name() [2/2]

◆ operator=() [1/2]

TaskThread & LDASTools::AL::TaskThread::operator= ( const TaskThread & Source)
private

◆ operator=() [2/2]

TaskThread & LDASTools::AL::TaskThread::operator= ( const TaskThread & Source)
private

◆ operator==() [1/2]

bool LDASTools::AL::Thread::operator== ( const Thread & Source) const
inherited

◆ operator==() [2/2]

bool LDASTools::AL::Thread::operator== ( const Thread & Source) const
inherited

◆ ParentThread() [1/2]

Thread::thread_type LDASTools::AL::Thread::ParentThread ( ) const
inlineinherited

Retrieve key for parent thread.

◆ ParentThread() [2/2]

thread_type LDASTools::AL::Thread::ParentThread ( ) const
inherited

Retrieve key for parent thread.

◆ SelfCancellationCheck() [1/2]

void LDASTools::AL::Thread::SelfCancellationCheck ( const std::string & Header,
const char * File,
const int Line )
staticinherited

◆ SelfCancellationCheck() [2/2]

void LDASTools::AL::Thread::SelfCancellationCheck ( const std::string & Header,
const char * File,
const int Line )
staticinherited

◆ set_cancelled_state() [1/2]

void LDASTools::AL::Thread::set_cancelled_state ( )
privateinherited

◆ set_cancelled_state() [2/2]

void LDASTools::AL::Thread::set_cancelled_state ( )
privateinherited

◆ SignalCapture() [1/2]

void LDASTools::AL::Thread::SignalCapture ( SignalHandler::signal_type Sig)
inherited

◆ SignalCapture() [2/2]

void LDASTools::AL::Thread::SignalCapture ( signal_type Sig)
inherited

◆ SignalIgnore() [1/2]

void LDASTools::AL::Thread::SignalIgnore ( SignalHandler::signal_type Sig)
inherited

◆ SignalIgnore() [2/2]

void LDASTools::AL::Thread::SignalIgnore ( signal_type Sig)
inherited

◆ Spawn() [1/2]

int LDASTools::AL::Thread::Spawn ( )
virtualinherited

◆ Spawn() [2/2]

virtual int LDASTools::AL::Thread::Spawn ( )
virtualinherited

◆ spawn() [1/2]

int LDASTools::AL::Thread::spawn ( start_function_type StartFunction = (start_function_typestart_routine)
protectedinherited

Spawn a new thread.

Parameters
[in]StartFunctionThe routine for the new thread to start.

◆ spawn() [2/2]

int LDASTools::AL::Thread::spawn ( start_function_type StartFunction = (start_function_typestart_routine)
protectedinherited

Spawn a new thread.

Parameters
[in]StartFunctionThe routine for the new thread to start.

◆ StackSizeDefault() [1/4]

size_t LDASTools::AL::Thread::StackSizeDefault ( )
inlinestaticinherited

◆ StackSizeDefault() [2/4]

size_t LDASTools::AL::Thread::StackSizeDefault ( )
staticinherited

◆ StackSizeDefault() [3/4]

void LDASTools::AL::Thread::StackSizeDefault ( size_t StackSize)
staticinherited

Establish the default value of the stack size used when creating new threads. This routine does validate the requested value..

◆ StackSizeDefault() [4/4]

void LDASTools::AL::Thread::StackSizeDefault ( size_t StackSize)
staticinherited

◆ start_routine() [1/2]

Thread * LDASTools::AL::Thread::start_routine ( Thread * ThreadSource)
staticprivateinherited

◆ start_routine() [2/2]

Thread * LDASTools::AL::Thread::start_routine ( Thread * ThreadSource)
staticprivateinherited

◆ State() [1/2]

◆ State() [2/2]

◆ StateStr() [1/2]

std::string LDASTools::AL::TaskThread::StateStr ( enum state_type Value)
static

◆ StateStr() [2/2]

std::string LDASTools::AL::TaskThread::StateStr ( enum state_type Value)
static

◆ threadId() [1/2]

Thread::thread_type LDASTools::AL::Thread::threadId ( ) const
inlineprotectedinherited

◆ threadId() [2/2]

thread_type LDASTools::AL::Thread::threadId ( ) const
protectedinherited

◆ TimedOut() [1/2]

◆ TimedOut() [2/2]

◆ TimedWait() [1/2]

◆ TimedWait() [2/2]

◆ Type() [1/2]

const char * LDASTools::AL::TaskThread::Type ( ) const
inline

◆ Type() [2/2]

const char * LDASTools::AL::TaskThread::Type ( ) const

◆ Wait() [1/2]

◆ Wait() [2/2]

Member Data Documentation

◆ detached

bool LDASTools::AL::Thread::detached
mutableprivateinherited

State of detached.

◆ m_cancel_method

◆ m_cancel_signal

◆ m_cancel_state

bool LDASTools::AL::Thread::m_cancel_state
mutableprivateinherited

Enable or disable the cancellability of a thread.

◆ m_cancel_thread

bool LDASTools::AL::Thread::m_cancel_thread
mutableprivateinherited

Conditional state of thread being cancelled.

◆ m_cancel_via_signal

signal_type LDASTools::AL::Thread::m_cancel_via_signal
privateinherited

Signal to use for cancelation.

◆ m_cancellation_type

cancel_type LDASTools::AL::Thread::m_cancellation_type
mutableprivateinherited

Method used for thread cancellation.

◆ m_done

◆ m_state

◆ m_task

◆ m_task_available

ConditionalVariable LDASTools::AL::TaskThread::m_task_available
private

◆ m_task_type_name

◆ p

boost::shared_ptr< impl > LDASTools::AL::Thread::p
privateinherited

◆ task_name


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/build/include/ldastoolsal/TaskThread.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/src/TaskThread.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-al-2.6.7-build/ldas-tools-al-2.6.7/src/TaskThread.cc