Public Member Functions | Protected Member Functions

ibrcommon::DetachedThread Class Reference

#include <Thread.h>

Inherits ibrcommon::Thread.

Inherited by dtn::daemon::ClientHandler, and dtn::net::TCPConvergenceLayer::TCPConnection.

Collaboration diagram for ibrcommon::DetachedThread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~DetachedThread ()
void exit (void)
void start (int priority=0) throw (ThreadException)
void stop () throw (ThreadException)

Protected Member Functions

 DetachedThread (size_t size=DEFAULT_STACKSIZE)

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 239 of file Thread.h.


Constructor & Destructor Documentation

ibrcommon::DetachedThread::DetachedThread ( size_t  size = DEFAULT_STACKSIZE  )  [protected]

Create a detached thread with a known context stack size.

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

Definition at line 305 of file Thread.cpp.

References ibrcommon::Thread::stack.

ibrcommon::DetachedThread::~DetachedThread (  )  [virtual]

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

Definition at line 315 of file Thread.cpp.


Member Function Documentation

void ibrcommon::DetachedThread::exit ( void   ) 

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 ibrcommon::Thread.

Definition at line 310 of file Thread.cpp.

void ibrcommon::DetachedThread::start ( int  priority = 0  )  throw (ThreadException)

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:
priority to start thread with.

Definition at line 319 of file Thread.cpp.

References ibrcommon::Thread::exec_thread().

Referenced by dtn::net::TCPConvergenceLayer::TCPConnection::initialize(), and dtn::daemon::ClientHandler::initialize().

Here is the call graph for this function:

void ibrcommon::DetachedThread::stop (  )  throw (ThreadException)

Stop the execution of child context.

Definition at line 356 of file Thread.cpp.

References ibrcommon::Thread::cancel().

Referenced by dtn::net::TCPConvergenceLayer::TCPConnection::eventTimeout(), dtn::net::TCPConvergenceLayer::TCPConnection::shutdown(), and dtn::daemon::ClientHandler::shutdown().

Here is the call graph for this function:


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