ucc::JoinableThread Class Reference

A child thread object that may be joined by parent. More...

#include <thread.h>

Inheritance diagram for ucc::JoinableThread:

Inheritance graph
[legend]
Collaboration diagram for ucc::JoinableThread:

Collaboration graph
[legend]

Public Member Functions

bool isRunning (void)
 Test if thread is currently running.
void start (int priority=0)
 Start execution of child context.
void background (void)
 Start execution of child context as background thread.

Protected Member Functions

 JoinableThread (size_t size=0)
 Create a joinable thread with a known context stack size.
virtual ~JoinableThread ()
 Delete child thread.
void join (void)
 Join thread with parent.

Detailed Description

A child thread object that may be joined by parent.

A child thread is a type of thread in which the parent thread (or process main thread) can then wait for the child thread to complete and then delete the child object. The parent thread can wait for the child thread to complete either by calling join, or performing a "delete" of the derived child object. In either case the parent thread will suspend execution until the child thread exits.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1541 of file thread.h.


Constructor & Destructor Documentation

ucc::JoinableThread::JoinableThread ( size_t  size = 0  )  [protected]

Create a joinable thread with a known context stack size.

Parameters:
size of stack for thread context or 0 for default.

virtual ucc::JoinableThread::~JoinableThread (  )  [protected, virtual]

Delete child thread.

Parent thread suspends until child thread run method completes or child thread calls it's exit method.


Member Function Documentation

void ucc::JoinableThread::background ( void   )  [inline]

Start execution of child context as background thread.

This is assumed to be off main thread, with a priority lowered by one.

Definition at line 1597 of file thread.h.

Here is the call graph for this function:

bool ucc::JoinableThread::isRunning ( void   )  [inline]

Test if thread is currently running.

Returns:
true while thread is running.

Definition at line 1579 of file thread.h.

void ucc::JoinableThread::join ( void   )  [protected]

Join thread with parent.

Calling from a child thread to exit is now depreciated behavior and in the future will not be supported. Threads should always return through their run() method.

void ucc::JoinableThread::start ( int  priority = 0  ) 

Start execution of child context.

This must be called after the child object is created (perhaps with "new") and before it can be joined. This method actually begins the new thread context, which then calls the object's run method. Optionally raise the priority of the thread when it starts under realtime priority.

Parameters:
priority of child thread.


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

Generated on Wed May 13 09:18:32 2009 for UCommon by  doxygen 1.5.8