ldas-tools-al  2.6.4
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
LDASTools::AL::Thread Class Referenceabstract

#include <Thread.hh>

Inheritance diagram for LDASTools::AL::Thread:
Inheritance graph
[legend]

Classes

class  cancellation
 
class  deadlock
 
class  invalid_argument
 
class  range_error
 
class  Self
 Operates on current thread. More...
 

Public Types

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 void(* cleanup_function_type) (void *)
 
typedef SignalHandler::signal_type signal_type
 
typedef void(* cleanup_function_type) (void *)
 

Public Member Functions

 Thread ()
 
virtual ~Thread ()
 
virtual void Cancel ()
 
void CancellationCheck (const std::string &Header, const char *File, const int Line) const
 Deliver pending cancellation requests to the calling thread. More...
 
void CancellationEnable (bool Value)
 
cancel_type CancellationType (signal_type &Signal) const
 Return the type of cancellation. More...
 
void CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN)
 Establiosh the type of cancellation. More...
 
void Detach () const
 
virtual void Join ()
 
bool IsAlive () const
 
bool IsCancelled () const
 Return the cancellation state of the thread. More...
 
bool IsDetached () const
 Reports detached state. More...
 
bool IsParentThread () const
 
int Kill (signal_type Signal) const
 
thread_type ParentThread () const
 Retrieve key for parent thread. More...
 
virtual int Spawn ()
 
void SignalCapture (signal_type Sig)
 
void SignalIgnore (signal_type Sig)
 
bool operator== (const Thread &Source) const
 
 Thread ()
 
virtual ~Thread ()
 
virtual void Cancel ()
 
void CancellationCheck (const std::string &Header, const char *File, const int Line) const
 Deliver pending cancellation requests to the calling thread. More...
 
void CancellationEnable (bool Value)
 
cancel_type CancellationType (signal_type &Signal) const
 Return the type of cancellation. More...
 
void CancellationType (cancel_type Type, signal_type Signal=SignalHandler::SIGNAL_UNKNOWN)
 Establiosh the type of cancellation. More...
 
void Detach () const
 
virtual void Join ()
 
bool IsAlive () const
 
bool IsCancelled () const
 Return the cancellation state of the thread. More...
 
bool IsDetached () const
 Reports detached state. More...
 
bool IsParentThread () const
 
int Kill (signal_type Signal) const
 
thread_type ParentThread () const
 Retrieve key for parent thread. More...
 
virtual int Spawn ()
 
void SignalCapture (signal_type Sig)
 
void SignalIgnore (signal_type Sig)
 
bool operator== (const Thread &Source) const
 

Static Public Member Functions

static void SelfCancellationCheck (const std::string &Header, const char *File, const int Line)
 
static size_t StackSizeDefault ()
 
static void StackSizeDefault (size_t StackSize)
 
static void SelfCancellationCheck (const std::string &Header, const char *File, const int Line)
 
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

virtual void action ()=0
 Job to be acomplished by the thread. More...
 
int spawn (start_function_type StartFunction=(start_function_type) start_routine)
 Spawn a new thread. More...
 
thread_type threadId () const
 
virtual void action ()=0
 Job to be acomplished by the thread. More...
 
int spawn (start_function_type StartFunction=(start_function_type) start_routine)
 Spawn a new thread. More...
 
thread_type threadId () const
 

Static Protected Member Functions

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

Private Member Functions

void cancellation_enable (bool Value)
 
void set_cancelled_state ()
 
void cancellation_enable (bool Value)
 
void set_cancelled_state ()
 

Static Private Member Functions

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

Private Attributes

boost::shared_ptr< impl > p
 
signal_type m_cancel_via_signal
 Signal to use for cancelation. More...
 
bool m_cancel_state
 Enable or disable the cancellability of a thread. More...
 
bool m_cancel_thread
 Conditional state of thread being cancelled. More...
 
cancel_type m_cancellation_type
 Method used for thread cancellation. More...
 
bool detached
 State of detached. More...
 

Member Typedef Documentation

◆ cleanup_function_type [1/2]

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

◆ cleanup_function_type [2/2]

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

◆ signal_type [1/2]

◆ signal_type [2/2]

◆ start_function_type [1/2]

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

◆ start_function_type [2/2]

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

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 

Constructor & Destructor Documentation

◆ Thread() [1/2]

LDASTools::AL::Thread::Thread ( )

◆ ~Thread() [1/2]

LDASTools::AL::Thread::~Thread ( )
virtual

◆ Thread() [2/2]

LDASTools::AL::Thread::Thread ( )

◆ ~Thread() [2/2]

virtual LDASTools::AL::Thread::~Thread ( )
virtual

Member Function Documentation

◆ action() [1/2]

virtual void LDASTools::AL::Thread::action ( )
protectedpure virtual

Job to be acomplished by the thread.

Implemented in LDASTools::AL::Log, LDASTools::AL::Log, LDASTools::AL::TaskThread, and LDASTools::AL::TaskThread.

◆ action() [2/2]

virtual void LDASTools::AL::Thread::action ( )
protectedpure virtual

Job to be acomplished by the thread.

Implemented in LDASTools::AL::Log, LDASTools::AL::Log, LDASTools::AL::TaskThread, and LDASTools::AL::TaskThread.

◆ Cancel() [1/2]

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

◆ Cancel() [2/2]

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

◆ cancelCleanup() [1/2]

void LDASTools::AL::Thread::cancelCleanup ( Thread Source)
staticprotected

Perform cleanup of a cancelled thread.

Parameters
[in]SourceThe thread being cancelled.

◆ cancelCleanup() [2/2]

static void LDASTools::AL::Thread::cancelCleanup ( Thread Source)
staticprotected

Perform cleanup of a cancelled thread.

Parameters
[in]SourceThe thread being cancelled.

◆ cancellation_enable() [1/2]

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

◆ cancellation_enable() [2/2]

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

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

◆ CancellationCheck() [1/2]

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

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

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)

◆ CancellationEnable() [2/2]

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

◆ CancellationType() [1/4]

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

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() [2/4]

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

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() [3/4]

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

Establiosh the type of cancellation.

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

◆ CancellationType() [4/4]

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

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

◆ Detach() [1/2]

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

◆ Detach() [2/2]

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

◆ IsAlive() [1/2]

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

◆ IsAlive() [2/2]

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

◆ IsCancelled() [1/2]

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

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

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

Reports detached state.

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

◆ IsDetached() [2/2]

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

Reports detached state.

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

◆ IsParentThread() [1/2]

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

◆ IsParentThread() [2/2]

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

◆ Join() [1/2]

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

◆ Join() [2/2]

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

◆ Kill() [1/2]

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

◆ Kill() [2/2]

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

◆ operator==() [1/2]

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

◆ operator==() [2/2]

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

◆ ParentThread() [1/2]

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

Retrieve key for parent thread.

◆ ParentThread() [2/2]

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

Retrieve key for parent thread.

◆ SelfCancellationCheck() [1/2]

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

◆ SelfCancellationCheck() [2/2]

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

◆ set_cancelled_state() [1/2]

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

◆ set_cancelled_state() [2/2]

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

◆ SignalCapture() [1/2]

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

◆ SignalCapture() [2/2]

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

◆ SignalIgnore() [1/2]

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

◆ SignalIgnore() [2/2]

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

◆ Spawn() [1/2]

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

◆ Spawn() [2/2]

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

◆ spawn() [1/2]

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

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)
protected

Spawn a new thread.

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

◆ StackSizeDefault() [1/4]

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

◆ StackSizeDefault() [2/4]

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

◆ StackSizeDefault() [3/4]

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

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

◆ StackSizeDefault() [4/4]

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

◆ start_routine() [1/2]

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

◆ start_routine() [2/2]

static Thread* LDASTools::AL::Thread::start_routine ( Thread ThreadSource)
staticprivate

◆ threadId() [1/2]

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

◆ threadId() [2/2]

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

Member Data Documentation

◆ detached

bool LDASTools::AL::Thread::detached
mutableprivate

State of detached.

◆ m_cancel_state

bool LDASTools::AL::Thread::m_cancel_state
mutableprivate

Enable or disable the cancellability of a thread.

◆ m_cancel_thread

bool LDASTools::AL::Thread::m_cancel_thread
mutableprivate

Conditional state of thread being cancelled.

◆ m_cancel_via_signal

signal_type LDASTools::AL::Thread::m_cancel_via_signal
private

Signal to use for cancelation.

◆ m_cancellation_type

cancel_type LDASTools::AL::Thread::m_cancellation_type
mutableprivate

Method used for thread cancellation.

◆ p

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

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