openMSX
thread
Thread.cc
Go to the documentation of this file.
1
#include "
Thread.hh
"
2
#include <cassert>
3
#include <thread>
4
5
namespace
openmsx::Thread
{
6
7
static
std::thread::id mainThreadId;
8
9
void
setMainThread
()
10
{
11
assert(mainThreadId == std::thread::id());
12
mainThreadId = std::this_thread::get_id();
13
}
14
15
bool
isMainThread
()
16
{
17
assert(mainThreadId != std::thread::id());
18
return
mainThreadId == std::this_thread::get_id();
19
}
20
21
}
// namespace openmsx::Thread
Thread.hh
openmsx::Thread
Definition
Thread.cc:5
openmsx::Thread::setMainThread
void setMainThread()
Store ID of the main thread, should be called exactly once from the main thread.
Definition
Thread.cc:9
openmsx::Thread::isMainThread
bool isMainThread()
Returns true when called from the main thread.
Definition
Thread.cc:15
Generated on Fri Oct 11 2024 19:13:47 for openMSX by
1.9.8