UCommon
Public Member Functions | Protected Member Functions | Protected Attributes
ucommon::DetachedThread Class Reference

A detached thread object that is stand-alone. More...

#include <thread.h>

Inheritance diagram for ucommon::DetachedThread:
Inheritance graph
[legend]
Collaboration diagram for ucommon::DetachedThread:
Collaboration graph
[legend]

Public Member Functions

bool isRunning (void)
 Check if running.
void start (int priority=0)
 Start execution of detached context.

Protected Member Functions

 DetachedThread (size_t size=0)
 Create a detached thread with a known context stack size.
void exit (void)
 Exit context of detached thread.
 ~DetachedThread ()
 Destroys object when thread context exits.

Protected Attributes

bool active

Detailed Description

A detached thread object that is stand-alone.

This object has no relationship with any other running thread instance will be automatically deleted when the running thread instance exits, either by it's run method exiting, or explicity calling the exit member function.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 1670 of file thread.h.


Constructor & Destructor Documentation

ucommon::DetachedThread::DetachedThread ( size_t  size = 0) [protected]

Create a detached thread with a known context stack size.

Parameters:
sizeof stack for thread context or 0 for default.
ucommon::DetachedThread::~DetachedThread ( ) [protected]

Destroys object when thread context exits.

Never externally deleted. Derived object may also have destructor to clean up thread-specific member data.


Member Function Documentation

void ucommon::DetachedThread::exit ( void  ) [protected, virtual]

Exit context of detached thread.

Thread object will be deleted. This function should NO LONGER be called directly to exit a running thread. Instead, the thread should only "return" through the run() method to exit. The documented usage was changed so that exit() can still be used to modify the "delete this" behavior of detached threads while merging thread exit behavior with Mozilla NSPR.

Reimplemented from ucommon::Thread.

void ucommon::DetachedThread::start ( int  priority = 0)

Start execution of detached context.

This must be called after the object is created (perhaps with "new"). This method actually begins the new thread context, which then calls the object's run method.

Parameters:
priorityto start thread with.

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