Same thread guard. More...
#include <same-thread-guard.hpp>
Public Member Functions | |
SameThreadGuard () | |
bool | check () |
On the first call it remembers the current thread id. More... | |
void | reset () |
Reset thread id. More... | |
Private Attributes | |
std::atomic< unsigned int > | mThreadId |
Same thread guard.
There are two purposes of this guard:
Usage example: ASSERT_SAME_THREAD(workerThreadGuard);
utils::SameThreadGuard::SameThreadGuard | ( | ) |
bool utils::SameThreadGuard::check | ( | ) |
On the first call it remembers the current thread id.
On the next call it verifies that current thread is the same as before.
void utils::SameThreadGuard::reset | ( | ) |
Reset thread id.
|
private |