CppCommon
1.0.4.1
C++ Common Library
|
#include <thread.h>
Public Member Functions | |
Thread ()=delete | |
Thread (const Thread &)=delete | |
Thread (Thread &&)=delete | |
~Thread ()=delete | |
Thread & | operator= (const Thread &)=delete |
Thread & | operator= (Thread &&)=delete |
Static Public Member Functions | |
static uint64_t | CurrentThreadId () noexcept |
Get the current thread Id. More... | |
static uint32_t | CurrentThreadAffinity () noexcept |
Get the current thread CPU affinity. More... | |
template<class Fn , class... Args> | |
static std::thread | Start (Fn &&fn, Args &&... args) |
Start a new thread with an exception handler registered. More... | |
static void | Sleep (int64_t milliseconds) noexcept |
Sleep the current thread for the given milliseconds. More... | |
static void | SleepFor (const Timespan ×pan) noexcept |
Sleep the current thread for the given timespan. More... | |
static void | SleepUntil (const UtcTimestamp ×tamp) noexcept |
Sleep the current thread until the given timestamp. More... | |
static void | Yield () noexcept |
Yield to other threads. More... | |
static std::bitset< 64 > | GetAffinity () |
Get the current thread CPU affinity bitset. More... | |
static std::bitset< 64 > | GetAffinity (std::thread &thread) |
Get the given thread CPU affinity bitset. More... | |
static void | SetAffinity (const std::bitset< 64 > &affinity) |
Set the current thread CPU affinity bitset. More... | |
static void | SetAffinity (std::thread &thread, const std::bitset< 64 > &affinity) |
Set the given thread CPU affinity bitset. More... | |
static ThreadPriority | GetPriority () |
Get the current thread priority. More... | |
static ThreadPriority | GetPriority (std::thread &thread) |
Get the given thread priority. More... | |
static void | SetPriority (ThreadPriority priority) |
Set the current thread priority. More... | |
static void | SetPriority (std::thread &thread, ThreadPriority priority) |
Set the given thread priority. More... | |
Thread abstraction.
Thread contains different kinds of thread manipulation functionality such as retrive the current thread Id, sleep for the given time period in nanoseconds, etc.
Thread-safe.
|
delete |
|
delete |
|
delete |
|
delete |
|
staticnoexcept |
Get the current thread CPU affinity.
Definition at line 71 of file thread.cpp.
|
staticnoexcept |
Get the current thread Id.
Definition at line 60 of file thread.cpp.
|
static |
Get the current thread CPU affinity bitset.
Definition at line 152 of file thread.cpp.
|
static |
Get the given thread CPU affinity bitset.
thread | - Thread |
Definition at line 203 of file thread.cpp.
|
static |
Get the current thread priority.
Definition at line 298 of file thread.cpp.
|
static |
Get the given thread priority.
thread | - Thread |
Definition at line 348 of file thread.cpp.
|
static |
Set the current thread CPU affinity bitset.
Definition at line 254 of file thread.cpp.
|
static |
|
static |
Set the given thread priority.
Definition at line 464 of file thread.cpp.
|
static |
Set the current thread priority.
priority | - Thread priority |
Definition at line 398 of file thread.cpp.
|
inlinestaticnoexcept |
Sleep the current thread for the given milliseconds.
milliseconds | - Milliseconds to sleep |
|
staticnoexcept |
Sleep the current thread for the given timespan.
timespan | - Timespan to sleep |
Definition at line 83 of file thread.cpp.
|
inlinestaticnoexcept |
|
inlinestatic |
Start a new thread with an exception handler registered.
Works the same way as std::thread() does but also register an exception handler with ExceptionsHandler.SetupThread() call.
Definition at line 45 of file thread.inl.
|
staticnoexcept |
Yield to other threads.
Definition at line 143 of file thread.cpp.