Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXThread Class Reference

FXThread provides system-independent support for threads. More...

#include <FXThread.h>

List of all members.

Public Member Functions

 FXThread ()
FXThreadID id () const
FXbool iscurrent () const
FXbool isrunning () const
FXbool start (unsigned long stacksize=0)
FXbool join ()
FXbool join (FXint &code)
FXbool cancel ()
FXbool detach ()
virtual ~FXThread ()

Static Public Member Functions

void exit (FXint code=0)
FXThreadID current ()


Detailed Description

FXThread provides system-independent support for threads.

Subclasses must implement the run() function do implement the desired functionality of the thread. The storage of the FXThread object is to be managed by the calling thread, not by the thread itself.


Constructor & Destructor Documentation

FX::FXThread::FXThread  ) 
 

Initialize thread object.

virtual FX::FXThread::~FXThread  )  [virtual]
 

Destroy the thread immediately, running or not.

It is probably better to wait until it is finished, in case the thread currently holds mutexes.


Member Function Documentation

FXThreadID FX::FXThread::id  )  const
 

Return handle of this thread object.

This handle is valid in the context of the thread which called start().

FXbool FX::FXThread::iscurrent  )  const
 

Return TRUE if this thread is the calling thread.

FXbool FX::FXThread::isrunning  )  const
 

Return TRUE if this thread is running.

FXbool FX::FXThread::start unsigned long  stacksize = 0  ) 
 

Start thread; the thread is started as attached.

The thread is given stacksize for its stack; a value of zero for stacksize will give it the default stack size.

FXbool FX::FXThread::join  ) 
 

Suspend calling thread until thread is done.

FXbool FX::FXThread::join FXint &  code  ) 
 

Suspend calling thread until thread is done, and set code to the return value of run() or the argument passed into exit().

If an exception happened in the thread, return -1.

FXbool FX::FXThread::cancel  ) 
 

Cancel the thread, stopping it immediately, running or not.

If the calling thread is this thread, nothing happens. It is probably better to wait until it is finished, in case the thread currently holds mutexes.

FXbool FX::FXThread::detach  ) 
 

Detach thread, so that a no join() is necessary to harvest the resources of this thread.

void FX::FXThread::exit FXint  code = 0  )  [static]
 

Exit the calling thread.

No destructors are invoked for objects on thread's stack; to invoke destructors, throw an exception instead.

FXThreadID FX::FXThread::current  )  [static]
 

Return thread handle of calling thread.

The handle is valid in the context of the current thread.

Copyright © 1997-2004 Jeroen van der Zijp