Poster of Linux kernelThe best gift for a Linux geek
ost::PosixThread

ost::PosixThread

Section: C Library Functions (3) Updated: 16 Feb 2010
Local index Up
 

NAME

ost::PosixThread -  

SYNOPSIS


#include <thread.h>

Inherits ost::Thread.  

Public Member Functions


PosixThread (int pri=0, size_t stack=0)

void signalThread (int signo)
Delivers a Posix signal to the current thread.  

Static Public Member Functions


static void sigInstall (int signo)
Install a signal handler for use by threads and the OnSignal() event notification handler.  

Protected Member Functions


void signalParent (signo_t signo)
In the Posix version of Common C++, this can be used to send a signal into the parent thread of the current object.
void signalMain (signo_t signo)
In the Posix version of Common C++, this can be used to send a signal into the main application thread.
virtual void onTimer (void)
A derivable method to call when a SIGALRM is being delivered to a specific thread.
virtual void onHangup (void)
A derived method to handle hangup events being delivered to a specific thread.
virtual void onException (void)
A derived method to call when a SIGABRT is being delivered to a specific thread.
virtual void onDisconnect (void)
A derived method to call when a SIGPIPE is being delivered to a specific thread.
virtual void onPolling (void)
A derived method to handle asynchronous I/O requests delivered to the specified thread.
virtual void onSignal (int)
A derivable method to call for delivering a signal event to a specified thread.
void setTimer (timeout_t timer, bool periodic=false)
Used to specify a timeout event that can be delivered to the current thread via SIGALRM.
timeout_t getTimer (void) const
Gets the time remaining for the current threads timer before it expires.
void endTimer (void)
Terminates the timer before the timeout period has expired.
void waitSignal (signo_t signo)
Used to wait on a Posix signal from another thread.
void setSignal (int signo, bool active)
Used to enable or disable a signal within the current thread.
pthread_attr_t * getPthreadAttrPtr (void)
Access to pthread_attr structure this allows setting/modifying pthread attributes not covered in the platform independant Thread constructor, e.g.
pthread_t getPthreadId (void)
Get pthread_t of underlying posix thread (useful for debugging/logging).  

Friends


class ThreadImpl

class Thread
 

Constructor & Destructor Documentation

 

ost::PosixThread::PosixThread (int pri = 0, size_t stack = 0)

 

Member Function Documentation

 

void ost::PosixThread::endTimer (void) [protected]

Terminates the timer before the timeout period has expired. This prevents the timer from sending it's SIGALRM and makes the timer available to other threads.  

pthread_attr_t* ost::PosixThread::getPthreadAttrPtr (void) [protected]

Access to pthread_attr structure this allows setting/modifying pthread attributes not covered in the platform independant Thread constructor, e.g. contention scope or scheduling policy  

pthread_t ost::PosixThread::getPthreadId (void) [protected]

Get pthread_t of underlying posix thread (useful for debugging/logging).  

timeout_t ost::PosixThread::getTimer (void) const [protected]

Gets the time remaining for the current threads timer before it expires. Returns:

time remaining before timer expires in milliseconds.

 

virtual void ost::PosixThread::onDisconnect (void) [protected, virtual]

A derived method to call when a SIGPIPE is being delivered to a specific thread.  

virtual void ost::PosixThread::onException (void) [protected, virtual]

A derived method to call when a SIGABRT is being delivered to a specific thread.  

virtual void ost::PosixThread::onHangup (void) [protected, virtual]

A derived method to handle hangup events being delivered to a specific thread.  

virtual void ost::PosixThread::onPolling (void) [protected, virtual]

A derived method to handle asynchronous I/O requests delivered to the specified thread.  

virtual void ost::PosixThread::onSignal (int) [protected, virtual]

A derivable method to call for delivering a signal event to a specified thread. Parameters:

- posix signal id.

 

virtual void ost::PosixThread::onTimer (void) [protected, virtual]

A derivable method to call when a SIGALRM is being delivered to a specific thread.  

void ost::PosixThread::setSignal (int signo, bool active) [protected]

Used to enable or disable a signal within the current thread. Parameters:

signo posix signal id.
active set to true to enable.

 

void ost::PosixThread::setTimer (timeout_t timer, bool periodic = false) [protected]

Used to specify a timeout event that can be delivered to the current thread via SIGALRM. When the timer expires, the onTimer() method is called for the thread. At present, only one thread timer can be active at any given time. On some operating systems (including Linux) a timer can be active on each thread.

Parameters:

timer timeout in milliseconds.
periodic should the timer be periodic.

Note:

currently, periodic timers are only available on systems with a working setitimer call.

 

static void ost::PosixThread::sigInstall (int signo) [static]

Install a signal handler for use by threads and the OnSignal() event notification handler. Parameters:

signo posix signal id.

 

void ost::PosixThread::signalMain (signo_t signo) [inline, protected]

In the Posix version of Common C++, this can be used to send a signal into the main application thread. Parameters:

signo a posix signal id.

 

void ost::PosixThread::signalParent (signo_t signo) [inline, protected]

In the Posix version of Common C++, this can be used to send a signal into the parent thread of the current object. Parameters:

signo a posix signal id.

 

void ost::PosixThread::signalThread (int signo) [inline]

Delivers a Posix signal to the current thread. Parameters:

signo a posix signal id.

References signalThread().

Referenced by signalThread().  

void ost::PosixThread::waitSignal (signo_t signo) [protected]

Used to wait on a Posix signal from another thread. This can be used as a crude rondevious/synchronization method between threads.

Parameters:

signo a posix signal id.

 

Friends And Related Function Documentation

 

friend class Thread [friend]

 

friend class ThreadImpl [friend]

Reimplemented from ost::Thread.

 

Author

Generated automatically by Doxygen for GNU CommonC++ from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Static Public Member Functions
Protected Member Functions
Friends
Constructor & Destructor Documentation
ost::PosixThread::PosixThread (int pri = 0, size_t stack = 0)
Member Function Documentation
void ost::PosixThread::endTimer (void) [protected]
pthread_attr_t* ost::PosixThread::getPthreadAttrPtr (void) [protected]
pthread_t ost::PosixThread::getPthreadId (void) [protected]
timeout_t ost::PosixThread::getTimer (void) const [protected]
virtual void ost::PosixThread::onDisconnect (void) [protected, virtual]
virtual void ost::PosixThread::onException (void) [protected, virtual]
virtual void ost::PosixThread::onHangup (void) [protected, virtual]
virtual void ost::PosixThread::onPolling (void) [protected, virtual]
virtual void ost::PosixThread::onSignal (int) [protected, virtual]
virtual void ost::PosixThread::onTimer (void) [protected, virtual]
void ost::PosixThread::setSignal (int signo, bool active) [protected]
void ost::PosixThread::setTimer (timeout_t timer, bool periodic = false) [protected]
static void ost::PosixThread::sigInstall (int signo) [static]
void ost::PosixThread::signalMain (signo_t signo) [inline, protected]
void ost::PosixThread::signalParent (signo_t signo) [inline, protected]
void ost::PosixThread::signalThread (int signo) [inline]
void ost::PosixThread::waitSignal (signo_t signo) [protected]
Friends And Related Function Documentation
friend class Thread [friend]
friend class ThreadImpl [friend]
Author

This document was created by man2html, using the manual pages.
Time: 21:51:51 GMT, April 16, 2011