Thread OS related code is abstracted into a simple "Threads" struct.
More...
#include <threads.h>
Thread OS related code is abstracted into a simple "Threads" struct.
Definition at line 51 of file threads.h.
§ ThreadEntryPoint
typedef void(* Threads::ThreadEntryPoint) (void *param) |
§ Create()
Definition at line 99 of file threads.h.
100 Handle* hdl =
new Handle;
102 hdl->callback = method;
103 hdl->winhdl = CreateThread(0, 0,
ThreadCaller, hdl, 0, &hdl->threadID);
106 throw std::runtime_error(
"Failed to create processing thread.");
static DWORD WINAPI ThreadCaller(void *param)
§ GetCPUCount()
static int Threads::GetCPUCount |
( |
| ) |
|
|
inlinestatic |
Definition at line 138 of file threads.h.
142 GetSystemInfo(&sysInfo);
143 return sysInfo.dwNumberOfProcessors;
§ RunningVistaOrBetter()
static bool Threads::RunningVistaOrBetter |
( |
| ) |
|
|
inlinestatic |
Definition at line 111 of file threads.h.
115 return v.dwMajorVersion >= 6;
§ SetBackgroundPriority()
static void Threads::SetBackgroundPriority |
( |
Handle * |
thread, |
|
|
bool |
bg |
|
) |
| |
|
inlinestatic |
Definition at line 118 of file threads.h.
120 HANDLE h = (HANDLE)thread;
123 SetThreadPriority(h, bg ? THREAD_MODE_BACKGROUND_BEGIN : THREAD_MODE_BACKGROUND_END);
125 SetThreadPriority(h, bg ? THREAD_PRIORITY_BELOW_NORMAL : THREAD_PRIORITY_NORMAL);
static bool RunningVistaOrBetter()
§ Sleep()
static void Threads::Sleep |
( |
int |
ms | ) |
|
|
inlinestatic |
Definition at line 134 of file threads.h.
static void Sleep(int ms)
§ ThreadCaller()
static DWORD WINAPI Threads::ThreadCaller |
( |
void * |
param | ) |
|
|
inlinestatic |
Definition at line 93 of file threads.h.
94 Handle* hdl = (Handle*)param;
95 hdl->callback (hdl->param);
§ WaitAndClose()
static void Threads::WaitAndClose |
( |
Handle * |
h | ) |
|
|
inlinestatic |
Definition at line 128 of file threads.h.
129 WaitForSingleObject(h->winhdl, INFINITE);
130 CloseHandle(h->winhdl);
The documentation for this struct was generated from the following file: