# VectorNav C++ Library: vn::xplat::Thread Class Reference

vn::xplat::Thread Class Reference

Represents a cross-platform thread. More...

`#include <thread.h>`

Inheritance diagram for vn::xplat::Thread:

## Public Types

typedef void(* | ThreadStartRoutine) (void *)
| Represents a start routine for a thread which will have data passed to it.

## Public Member Functions

void | start (void *routineData)
| Starts the thread. More...
void | join ()
| Blocks the calling thread until this thread finishes.

## Static Public Member Functions

static Thread * | startNew (ThreadStartRoutine startRoutine, void *routineData)
| Starts a new thread immediately which calls the provided start routine and passes the routine data to the new thread. More...
static void | sleepSec (uint32_t numOfSecsToSleep)
| Causes the thread to sleep the specified number of seconds. More...
static void | sleepMs (uint32_t numOfMsToSleep)
| Causes the thread to sleep the specified number of milliseconds. More...
static void | sleepUs (uint32_t numOfUsToSleep)
| Causes the thread to sleep the specified number of microseconds. More...
static void | sleepNs (uint32_t numOfNsToSleep)
| Causes the thread to sleep the specified number of nanoseconds. More...

## Detailed Description

Represents a cross-platform thread.

## Member Function Documentation

static void vn::xplat::Thread::sleepMs | ( | uint32_t | numOfMsToSleep | ) |

static

Causes the thread to sleep the specified number of milliseconds.

Parameters

  [in] | numOfMsToSleep | The number of milliseconds to sleep.

static void vn::xplat::Thread::sleepNs | ( | uint32_t | numOfNsToSleep | ) |

static

Causes the thread to sleep the specified number of nanoseconds.

Parameters

  [in] | numOfNsToSleep | The number of nanoseconds to sleep.

static void vn::xplat::Thread::sleepSec | ( | uint32_t | numOfSecsToSleep | ) |

static

Causes the thread to sleep the specified number of seconds.

Parameters

  [in] | numOfSecsToSleep | The number of seconds to sleep.

static void vn::xplat::Thread::sleepUs | ( | uint32_t | numOfUsToSleep | ) |

static

Causes the thread to sleep the specified number of microseconds.

Parameters

  [in] | numOfUsToSleep | The number of microseconds to sleep.

void vn::xplat::Thread::start | ( | void * | routineData | ) |

Starts the thread.

Parameters

  [in] | routineData | Pointer to the routine data which the new thread have access to.

static Thread* vn::xplat::Thread::startNew | ( | ThreadStartRoutine | startRoutine,
|  | void * | routineData
| ) |  |

static

Starts a new thread immediately which calls the provided start routine and passes the routine data to the new thread.

Parameters

  [in] | startRoutine | The routine to be called when the new thread is started.
  [in] | routineData | Pointer to data that will be passed to the new thread via its start routine.

Returns
  A `Thread` object representing the newly started thread. User must delete the returned pointer when finished.

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

- include/vn/thread.h