openMSX
Main Page
Namespaces
Classes
Files
File List
File Members
thread
Semaphore.cc
Go to the documentation of this file.
1
#include "
Semaphore.hh
"
2
3
namespace
openmsx
{
4
5
Semaphore::Semaphore
(
unsigned
value)
6
: value(value)
7
{
8
}
9
10
void
Semaphore::up
()
11
{
12
std::unique_lock<std::mutex> lock(mutex);
13
value++;
14
condition.notify_one();
15
}
16
17
void
Semaphore::down
()
18
{
19
std::unique_lock<std::mutex> lock(mutex);
20
condition.wait(lock, [&]() {
return
value != 0; });
21
value--;
22
}
23
24
}
// namespace openmsx
Semaphore.hh
openmsx::Semaphore::up
void up()
Definition:
Semaphore.cc:10
openmsx::Semaphore::down
void down()
Definition:
Semaphore.cc:17
openmsx
Thanks to enen for testing this on a real cartridge:
Definition:
Autofire.cc:5
openmsx::Semaphore::Semaphore
Semaphore(unsigned value)
Definition:
Semaphore.cc:5
Generated on Wed May 6 2015 21:21:05 for openMSX by
1.8.9.1