#include <ThreadImpl.h>
Inheritance diagram for ZThread::ThreadImpl:
Public Member Functions | |
bool | join (unsigned long) |
void | setPriority (Priority) |
bool | isActive () |
Static Public Member Functions | |
static void | sleep (unsigned long) |
static void | yield () |
static ThreadImpl * | current () |
ThreadImpl * ZThread::ThreadImpl::current | ( | ) | [static] |
Get a reference to an implmenetation that maps to the current thread. Accomplished by checking the TLS map. This will always return a valid ThreadImpl instance.
bool ZThread::ThreadImpl::isActive | ( | ) |
Test the state Monitor of this thread to determine if the thread is an active thread created by zthreads.
bool ZThread::ThreadImpl::join | ( | unsigned long | timeout | ) |
Join the thread, blocking the caller until it is interrupted or until the thread represented by this object exits.
Reference threads are not under the control of ZThreads and cannot be joined.
void ZThread::ThreadImpl::setPriority | ( | Priority | p | ) |
Translate the priority into a pthread value, and update the thread priority.
This is not available on all platforms, and probably works differently the platforms that do support it. Pthreads does not have very portable priority support as far I am aware.
If SCHED_OTHER is not supported priority values are still set but dont not actually in affect anything.
prio | PRIORITY value |
Killed_Exception | thrown by KILLED threads. | |
InvalidOp_Exception | thrown by IDLE, JOINING or JOINED threads. |
void ZThread::ThreadImpl::sleep | ( | unsigned long | ms | ) | [static] |
Make current thread sleep for the given number of milliseconds. This sleep can be interrupt()ed.
ms | timeout for the sleep. |
void ZThread::ThreadImpl::yield | ( | ) | [static] |
Yield the current timeslice to another thread. If sched_yield() is available it is used. Otherwise, the state Monitor for this thread is used to simiulate a yield by blocking for 1 millisecond, which should give the scheduler a chance to schedule another thread.