CrystalSpace

Public API Reference

CS::Threading::Thread Class Reference

Object representing a separate execution thread. More...

#include <csutil/threading/thread.h>

Inheritance diagram for CS::Threading::Thread:

List of all members.

Public Member Functions

ThreadPriority GetPriority () const
 Get current execution priority for this thread.
bool IsRunning () const
 Return whether thread is running or not.
bool SetPriority (ThreadPriority prio)
 Set the current execution priority of this thread.
void Start ()
 Start the thread.
void Stop ()
 Unmercifully stop the thread as soon as possible.
 Thread (Runnable *runnable, bool start, ThreadPriority prio)
 Initialize a new thread object.
 Thread (Runnable *runnable, ThreadPriority prio)
 Initialize a new thread object.
 Thread (Runnable *runnable, bool start=false)
 Initialize a new thread object.
void Wait () const
 Wait for thread to finish its execution.

Static Public Member Functions

static ThreadID GetThreadID ()
 Get an OS specific thread identifier.
static void Yield ()
 Yield Thread frees CPU time if nothing to do.

Detailed Description

Object representing a separate execution thread.

Used to create, manage and control execution threads.

Definition at line 103 of file thread.h.


Constructor & Destructor Documentation

CS::Threading::Thread::Thread ( Runnable runnable,
bool  start = false 
) [inline]

Initialize a new thread object.

Parameters:
runnable Runnable object to connect the thread to.
start If execution in the new thread should start immediately or if you have to start it manually.

Definition at line 117 of file thread.h.

CS::Threading::Thread::Thread ( Runnable runnable,
ThreadPriority  prio 
) [inline]

Initialize a new thread object.

Parameters:
runnable Runnable object to connect the thread to.
prio Initial execution priority.

Definition at line 129 of file thread.h.

CS::Threading::Thread::Thread ( Runnable runnable,
bool  start,
ThreadPriority  prio 
) [inline]

Initialize a new thread object.

Parameters:
runnable Runnable object to connect the thread to.
prio Initial execution priority.
start If execution in the new thread should start immediately or if you have to start it manually.

Definition at line 142 of file thread.h.


Member Function Documentation

ThreadPriority CS::Threading::Thread::GetPriority (  )  const [inline]

Get current execution priority for this thread.

Definition at line 201 of file thread.h.

static ThreadID CS::Threading::Thread::GetThreadID (  )  [inline, static]

Get an OS specific thread identifier.

Remarks:
This gets the thread id of the thread in which this function is called. For example, OtherThread->GetThreadID() will NOT have the results that would be expected.

Definition at line 231 of file thread.h.

bool CS::Threading::Thread::IsRunning (  )  const [inline]

Return whether thread is running or not.

Definition at line 181 of file thread.h.

bool CS::Threading::Thread::SetPriority ( ThreadPriority  prio  )  [inline]

Set the current execution priority of this thread.

The specifics of when this takes effect and what underlying platform priority each value maps to are properties of the specific platform-based implementation.

Returns:
true if the priority was successfully set.

Definition at line 193 of file thread.h.

void CS::Threading::Thread::Start (  )  [inline]

Start the thread.

Definition at line 160 of file thread.h.

void CS::Threading::Thread::Stop (  )  [inline]

Unmercifully stop the thread as soon as possible.

This method performs a dirty shutdown of the thread. The thread is not given a chance to exit normally. Do not invoke this method unless you have a very good reason for doing so. In general, it is best to implement some sort of communication with threads so that you can ask them to terminate in an orderly fashion.

Definition at line 173 of file thread.h.

void CS::Threading::Thread::Wait (  )  const [inline]

Wait for thread to finish its execution.

This will block until thread is finished.

Definition at line 210 of file thread.h.

static void CS::Threading::Thread::Yield (  )  [inline, static]

Yield Thread frees CPU time if nothing to do.

Remarks:
This Yields execution time in the thread in which this function is called. For example, OtherThread->Yield() will NOT have the results that would be expected.

Definition at line 221 of file thread.h.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1