Wefts::OSThreadWindows Class Reference

#include <wefts_os_windows.h>

Inheritance diagram for Wefts::OSThreadWindows:

Inheritance graph
[legend]
Collaboration diagram for Wefts::OSThreadWindows:

Collaboration graph
[legend]
List of all members.

Detailed Description

Wraps Windows threads.

See also:
OS Threading Abstraction (and Independence) Layer


Public Member Functions

 OSThreadWindows ()
 OSThreadWindows (bool val)
 ~OSThreadWindows ()
virtual bool priority (OSPriority prio_class, int boost=0)
 Sets WinAPI priority level and boost.

bool start (void *(*func)(void *), void *data)
bool stop ()
void * join () throw ( NotJoinableError )
int enableCancel ()
 We support only deferred emulated cancellation.

int disableCancel ()
 We support only deferred emulated cancellation.

bool setCancelState (int state)
virtual void * osRun (void *(*func)(void *), void *data, void(*cleanup)(void *))
void testCancel ()
void setCancelDeferred ()
 Always in emulated deferred mode.

void detach ()
void exit (void *data)
bool same () const
bool equal (const OSThreadBase &th) const
virtual bool setCurrent ()
virtual void invalidate ()

Private Attributes

DWORD m_thid
 windows thread id

HANDLE m_hth
 Windows thread handle.

bool m_valid
 true if this thread is considered valid

HANDLE m_evtCancel
 cancellation control

bool m_wasCanceled
 Used to reset cancel event after a section where cancellation is disabled.

bool m_canCancel
 Kind cancellation control.

void(* m_rawCleanup )(void *)
 Pointer to thread raw cleanup function.

void * m_rawCleanData
 Pointer to thread raw cleanup data.


Friends

bool OSSleep (long nSeconds, long nNanoseconds)
 Function to provide a wefts-interruptable wait.


Constructor & Destructor Documentation

Wefts::OSThreadWindows::OSThreadWindows  ) 
 

Wefts::OSThreadWindows::OSThreadWindows bool  val  )  [inline]
 

Wefts::OSThreadWindows::~OSThreadWindows  ) 
 


Member Function Documentation

void Wefts::OSThreadWindows::detach  )  [inline, virtual]
 

Implements Wefts::OSThreadBase.

int Wefts::OSThreadWindows::disableCancel  )  [virtual]
 

We support only deferred emulated cancellation.

Implements Wefts::OSThreadBase.

int Wefts::OSThreadWindows::enableCancel  )  [virtual]
 

We support only deferred emulated cancellation.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadWindows::equal const OSThreadBase th  )  const [inline, virtual]
 

Implements Wefts::OSThreadBase.

void Wefts::OSThreadWindows::exit void *  data  )  [virtual]
 

Implements Wefts::OSThreadBase.

virtual void Wefts::OSThreadWindows::invalidate  )  [virtual]
 

Implements Wefts::OSThreadBase.

void* Wefts::OSThreadWindows::join  )  throw ( NotJoinableError ) [virtual]
 

Implements Wefts::OSThreadBase.

virtual void* Wefts::OSThreadWindows::osRun void *(*  func)(void *),
void *  data,
void(*  cleanup)(void *)
[virtual]
 

Implements Wefts::OSThreadBase.

virtual bool Wefts::OSThreadWindows::priority OSPriority  prio_class,
int  boost = 0
[virtual]
 

Sets WinAPI priority level and boost.

Windows api sets thread priority class based on a differential status with respect to the process standard priority. This function supposes that the process is started with "normal" priority schedule, and then it sets the priority class of threads based on this assumption.

Wefts users should not change the process default priority, but they should use Thread::priority() instead.

In the specific: prio_class is set as the base thread priority value; boost adds or subtracts some point from the base class. Also, boost is set as Windows dynamic priority boost if it's in range 1..3; if it's higher than 3, dynamic priority boost is set to 3.

See also:
OSThreadBase::priority() for more details on Wefts abstract priority system.
Parameters:
prio_class Wefts priority class that the thread should run in.
boost extra boost with respect to abstract priority class.
Returns:
true on success, false on failure.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadWindows::same  )  const [inline, virtual]
 

Implements Wefts::OSThreadBase.

void Wefts::OSThreadWindows::setCancelDeferred  )  [inline, virtual]
 

Always in emulated deferred mode.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadWindows::setCancelState int  state  )  [inline, virtual]
 

Implements Wefts::OSThreadBase.

virtual bool Wefts::OSThreadWindows::setCurrent  )  [virtual]
 

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadWindows::start void *(*  func)(void *),
void *  data
[virtual]
 

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadWindows::stop  )  [virtual]
 

Implements Wefts::OSThreadBase.

void Wefts::OSThreadWindows::testCancel  )  [virtual]
 

Implements Wefts::OSThreadBase.


Friends And Related Function Documentation

bool OSSleep long  nSeconds,
long  nNanoseconds
[friend]
 

Function to provide a wefts-interruptable wait.


Member Data Documentation

bool Wefts::OSThreadWindows::m_canCancel [private]
 

Kind cancellation control.

HANDLE Wefts::OSThreadWindows::m_evtCancel [private]
 

cancellation control

HANDLE Wefts::OSThreadWindows::m_hth [private]
 

Windows thread handle.

void* Wefts::OSThreadWindows::m_rawCleanData [private]
 

Pointer to thread raw cleanup data.

This pointer holds generally a pointer to a Wefts::Thread or subclass, and is initializated in osRun() by functions in wefts_thread.c

void(* Wefts::OSThreadWindows::m_rawCleanup)(void *) [private]
 

Pointer to thread raw cleanup function.

This function is usually defined in wefts_thread.c and has the duty to call the high-level thread layer.

DWORD Wefts::OSThreadWindows::m_thid [private]
 

windows thread id

bool Wefts::OSThreadWindows::m_valid [private]
 

true if this thread is considered valid

bool Wefts::OSThreadWindows::m_wasCanceled [private]
 

Used to reset cancel event after a section where cancellation is disabled.

disableCancel will set this to true if the event that commands the thread to be canceled was set. Then if enableCancel is issued, the event is set again if it was set before.


The documentation for this class was generated from the following file:
Generated on Tue Oct 5 14:57:02 2004 for Wefts by doxygen 1.3.7