blocxx
Public Member Functions

BLOCXX_NAMESPACE::Runnable Class Reference

There are two methods for creating a thread of execution in the blocxx systems. More...

#include <Runnable.hpp>

Inheritance diagram for BLOCXX_NAMESPACE::Runnable:
BLOCXX_NAMESPACE::IntrusiveCountableBase

List of all members.

Public Member Functions

virtual ~Runnable ()
virtual void run ()=0
virtual void doShutdown ()
 This function is available for subclasses of Thread to override if they wish to be notified when shutdown() is invoked on the instance.
virtual void doCooperativeCancel ()
 This function is available for subclasses to override if they wish to be notified when a cooperative cancel is being invoked on the thread.
virtual void doDefinitiveCancel ()
 See the documentation for doCooperativeCancel().

Detailed Description

There are two methods for creating a thread of execution in the blocxx systems.

One is to derive from Thread and implement the run method and call start on instances of the class to get the thread running. The other method is to derive from Runnable and pass references of the derived class to ThreadPool::addWork()

Definition at line 57 of file Runnable.hpp.


Constructor & Destructor Documentation

BLOCXX_NAMESPACE::Runnable::~Runnable ( ) [virtual]

Definition at line 47 of file Runnable.cpp.


Member Function Documentation

void BLOCXX_NAMESPACE::Runnable::doCooperativeCancel ( ) [virtual]

This function is available for subclasses to override if they wish to be notified when a cooperative cancel is being invoked on the thread.

Note that this function will be invoked in a separate thread.

It is also possible for an individual thread to override the cancellation request, if it knows that cancellation at this time may crash the system or cause a deadlock. To do this, the thread should throw an CancellationDeniedException. Note that threads are usually only cancelled in the event of a system shutdown or restart, so a thread should make a best effort to actually shutdown.

Exceptions:
CancellationDeniedException

Definition at line 59 of file Runnable.cpp.

void BLOCXX_NAMESPACE::Runnable::doDefinitiveCancel ( ) [virtual]

See the documentation for doCooperativeCancel().

When definitiveCancel() is called on a thread, first doCooperativeCancel() will be called, and then doDefinitiveCancel() will be called.

Exceptions:
CancellationDeniedException

Definition at line 65 of file Runnable.cpp.

void BLOCXX_NAMESPACE::Runnable::doShutdown ( ) [virtual]

This function is available for subclasses of Thread to override if they wish to be notified when shutdown() is invoked on the instance.

This function will be invoked in a separate thread. For instance, a thread may use this function to: 1. Set a flag and then signal a condition variable to wake up the thread. 2. Write to a pipe or socket, if Thread::run() is blocked in select(), it can be unblocked and then exit.

Definition at line 53 of file Runnable.cpp.

virtual void BLOCXX_NAMESPACE::Runnable::run ( ) [pure virtual]

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