Crystal Space: csThread Class Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csThread Class Reference

Representation of a thread of executation. More...

`#include <csutil/thread.h>`

Inheritance diagram for csThread:

[legend]
List of all members.

## Public Member Functions
virtual char const * | GetLastError () const =0
| Return the last error description, else 0 if there was none.
virtual csThreadPriority | GetPriority ()=0
| Retrieve the current execution priority of this thread.
virtual bool | SetPriority (csThreadPriority Priority)=0
| Set the current execution priority of this thread.
virtual bool | Start ()=0
| Start the thread.
virtual bool | Stop ()=0
| Unmercifully stop the thread as soon as possible.
virtual bool | Wait ()=0
| Wait for the thread to die.
virtual void | Yield ()=0
| Yield Thread frees CPU time if nothing to do.
## Static Public Member Functions
static csRef< csThread > | Create (csRunnable *, uint32 options=0)
| Create a new thread.

## Detailed Description

Representation of a thread of executation.

Definition at line 106 of file thread.h.

## Member Function Documentation

static csRef<csThread> csThread::Create | ( | csRunnable * | ,
|  | uint32 | options = `0` |
| ) |  |  | `[static]`

Create a new thread.

Returns the new thread object. The thread begins running when the Start() method is invoked.

virtual char const* csThread::GetLastError | ( |  | ) | const`[pure virtual]`

Return the last error description, else 0 if there was none.

virtual csThreadPriority csThread::GetPriority | ( |  | ) | `[pure virtual]`

Retrieve the current execution priority of this thread.

Returns:
  A member of the csThreadPriority enumeration

virtual bool csThread::SetPriority | ( | csThreadPriority | Priority | ) | `[pure virtual]`

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.

virtual bool csThread::Start | ( |  | ) | `[pure virtual]`

Start the thread.

If something goes awry false is returned.

virtual bool csThread::Stop | ( |  | ) | `[pure virtual]`

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. Returns true if the thread was killed.

virtual bool csThread::Wait | ( |  | ) | `[pure virtual]`

Wait for the thread to die.

Only returns once the thread has terminated.

virtual void csThread::Yield | ( |  | ) | `[pure virtual]`

Yield Thread frees CPU time if nothing to do.

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

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

- csutil/thread.h