ZThread::ThreadImpl Class Reference

#include <ThreadImpl.h>

Inheritance diagram for ZThread::ThreadImpl:

ZThread::IntrusivePtr< T, LockType > ZThread::NonCopyable List of all members.

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 ThreadImplcurrent ()

Detailed Description

Author:
Eric Crahen <http://www.code-foo.com>
Date:
<2003-07-27T13:39:03-0400>
Version:
2.3.0


Member Function Documentation

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.

Returns:
ThreadImpl* current implementation that maps to the executing thread.

bool ZThread::ThreadImpl::isActive (  ) 

Test the state Monitor of this thread to determine if the thread is an active thread created by zthreads.

Returns:
bool indicating the activity of the thread.

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.

Parameters:
prio PRIORITY value
Exceptions:
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.

Parameters:
ms timeout for the sleep.
Postcondition:
the calling thread is blocked by waiting on the internal condition variable. This can be signaled in the monitor of an interrupt

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.


The documentation for this class was generated from the following files:
Generated on Wed Aug 30 03:27:49 2006 for SWG EMU by  doxygen 1.4.7