# VectorNav C++ Library: include/vn/thread.h Source File

thread.h
Go to the documentation of this file.
#ifndef _VNXPLAT_THREAD_H_
#define _VNXPLAT_THREAD_H_
#include "int.h"
#include "export.h"
#include "nocopy.h"
#if _WIN32
#include <Windows.h>
#elif __linux__ || __APPLE__ || __CYGWIN__ || __QNXNTO__
#include <pthread.h>
#include <unistd.h>
#else
#error "Unknown System"
#endif
namespace vn {
namespace xplat {
class vn_proglib_DLLEXPORT Thread : private util::NoCopy
{
// Types //////////////////////////////////////////////////////////////////
public:
typedef void (*ThreadStartRoutine)(void*);
// Constructors ///////////////////////////////////////////////////////////
public:
~Thread();
private:
explicit Thread(ThreadStartRoutine startRoutine);
// Public Methods /////////////////////////////////////////////////////////
public:
static Thread* startNew(ThreadStartRoutine startRoutine, void* routineData);
void start(void* routineData);
void join();
static void sleepSec(uint32_t numOfSecsToSleep);
static void sleepMs(uint32_t numOfMsToSleep);
static void sleepUs(uint32_t numOfUsToSleep);
static void sleepNs(uint32_t numOfNsToSleep);
// Private Members ////////////////////////////////////////////////////////
private:
// Contains internal data, mainly stuff that is required for cross-platform
// support.
struct Impl;
Impl *_pimpl;
};
}
}
#endif
int.h
nocopy.h
vn::xplat::Thread
Represents a cross-platform thread.
Definition: thread.h:26
xplat
Definition: mock.h:4
vn::util::NoCopy
Identifies a derived class as being unable to be copied and prevents copy attempts.
Definition: nocopy.h:21
vn
Definition: attitude.h:8