OpenZWave::Thread Class Reference

Implements a platform-independent thread management class. More...

`#include <Thread.h>`

Inheritance diagram for OpenZWave::Thread:

## Public Types

typedef void(* | pfnThreadProc_t) (Event *_exitEvent, void *_context)
Public Types inherited from OpenZWave::Wait
enum | { Timeout_Immediate = 0, Timeout_Infinite = -1 }
typedef void(* | pfnWaitNotification_t) (void *_context)

## Public Member Functions

| Thread (string const &_name)
bool | Start (pfnThreadProc_t _pfnThreadProc, void *_context)
bool | Stop ()
void | Sleep (uint32 _millisecs)
Public Member Functions inherited from OpenZWave::Wait
void | AddWatcher (pfnWaitNotification_t _callback, void *_context)
void | RemoveWatcher (pfnWaitNotification_t _callback, void *_context)
Public Member Functions inherited from OpenZWave::Ref
| Ref ()
void | AddRef ()
int32 | Release ()

## Protected Member Functions

virtual bool | IsSignalled ()
virtual | ~Thread ()
Protected Member Functions inherited from OpenZWave::Wait
| Wait ()
virtual | ~Wait ()
void | Notify ()
Protected Member Functions inherited from OpenZWave::Ref
virtual | ~Ref ()

## Additional Inherited Members

Static Public Member Functions inherited from OpenZWave::Wait
static int32 | Single (Wait *_object, int32 _timeout=-1)
static int32 | Multiple (Wait **_objects, uint32 _numObjects, int32 _timeout=-1)

## Detailed Description

Implements a platform-independent thread management class.

## Member Typedef Documentation

## pfnThreadProc_t

typedef void(* OpenZWave::Thread::pfnThreadProc_t) (Event *_exitEvent, void *_context)

## Constructor & Destructor Documentation

## Thread()

Thread::Thread | ( | string const & | _name | ) |

Constructor. Creates a thread object that can be used to serialize access to a shared resource.

## ~Thread()

Thread::~Thread | ( |  | ) |

protected virtual

Destructor. Destroys the Thread object.

## Member Function Documentation

## IsSignalled()

bool Thread::IsSignalled | ( |  | ) |

protected virtual

Used by the Wait class to test whether the thread has been completed.

Implements OpenZWave::Wait.

## Sleep()

void Thread::Sleep | ( | uint32 | _millisecs | ) |

Causes the thread to sleep for the specified number of milliseconds.

Parameters

  _millisecs | Number of milliseconds to sleep.

## Start()

bool Thread::Start | ( | pfnThreadProc_t | _pfnThreadProc,
|  | void * | _context
| ) |  |

Start running a function on this thread. Attempts to start a function running on this thread. The call will fail if another function is already running.

Parameters

  _pThreadProc | pointer to the function to be run. The function must take a single void pointer as its only argument, and return void. On entry, the pointer will be set to the context provided to this Start method.
  _context | pointer allowing any relevant data to be passed to the thread function.

Returns
  True if the function was successfully started.

See also
  Stop, IsRunning

## Stop()

bool Thread::Stop | ( |  | ) |

Stop a function running on this thread. Attempts to stop a function running on this thread. The call will fail if no function is running.

Returns
  True if the function was successfully stopped.

See also
  Start, IsRunning

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

- Thread.h
- Thread.cpp