XFcThread class Reference

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

# XFcThread Class Reference

Common thread handling. More...

List of all members.

## Public Member Functions

XFCIMPORT INT32 | waitDeath ()
| Blocks until the thread ends and returns exit code.
virtual XFCIMPORT | ~XFcThread ()
| Virtual destructor.

## Static Public Member Functions

XFCIMPORT XFcThread * | create (INT32(*aFunc)(void *), void *aArg)
| Creates a new thread and starts running it.
XFCIMPORT void | exit (INT32 aExitCode)
| Exits the caller thread.
XFCIMPORT UINT32 | getId ()
| Returns identifier of the caller thread.

## Protected Member Functions

| XFcThread ()
| Protected constructor.
INT | init (INT32(*aFunc)(void *), void *aArg)
| Initializes a thread and starts running it.

## Private Attributes

void * | mThread
| Thread handle.

## Detailed Description

Common thread handling.

This class encapsulates thread handling routines in a platform-independent way.

See also:
  XFcThreadObject

  XFcMutex

Note:
  It is possible that some platforms do not have thread support.

  Using threads generally slow down some systems.

## Constructor & Destructor Documentation

virtual XFCIMPORT XFcThread::~XFcThread | ( |  | ) | `[virtual]`

Virtual destructor.

See also:
  create

XFcThread::XFcThread | ( |  | ) | `[protected]`

| Protected constructor.

## Member Function Documentation

XFCIMPORT XFcThread* XFcThread::create | ( | INT32(* | aFunc)(void *),
|  | void * | aArg
| ) | `[static]`

Creates a new thread and starts running it.

Parameters:

  aFunc | thread function pointer.
  aArg | argument passed to the thread function.

Returns:
  pointer to the new thread object or NULL if operation failed.

Note:
  You should always use waitDeath() exactly once for each thread before deleting the thread object.

XFCIMPORT void XFcThread::exit | ( | INT32 | aExitCode | ) | `[static]`

Exits the caller thread.

Parameters:

  aExitCode | Exit code for the thread.

XFCIMPORT UINT32 XFcThread::getId | ( |  | ) | `[static]`

Returns identifier of the caller thread.

Returns:
  Unique thread identifier for this thread.

INT XFcThread::init | ( | INT32(* | aFunc)(void *),
|  | void * | aArg
| ) | `[protected]`

Initializes a thread and starts running it.

Parameters:

  aFunc | thread function pointer
  aArg | argument passed to the thread function

Returns:
  1 if operation was successful, 0 otherwise

XFCIMPORT INT32 XFcThread::waitDeath | ( |  | ) |

Blocks until the thread ends and returns exit code.

Note:
  This must be called only once per existing thread.

## Member Data Documentation

void* XFcThread::mThread`[private]`

| Thread handle.

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch