Luanti
5.11.0-dev
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1
/*
2
This file is a part of the JThread package, which contains some object-
3
oriented thread wrappers for different thread implementations.
4
5
Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com)
6
7
Permission is hereby granted, free of charge, to any person obtaining a
8
copy of this software and associated documentation files (the "Software"),
9
to deal in the Software without restriction, including without limitation
10
the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
and/or sell copies of the Software, and to permit persons to whom the
12
Software is furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be included in
15
all copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
DEALINGS IN THE SOFTWARE.
24
*/
25
26
#pragma once
27
28
#include <condition_variable>
29
36
class
Event
37
{
38
public
:
39
void
wait
();
40
void
signal
();
41
42
private
:
43
std::condition_variable
cv
;
44
std::mutex
mutex
;
45
bool
notified
=
false
;
46
};
Event
A syncronization primitive that will wake up one waiting thread when signaled.
Definition
event.h:37
Event::wait
void wait()
Definition
event.cpp:29
Event::signal
void signal()
Definition
event.cpp:39
Event::notified
bool notified
Definition
event.h:45
Event::cv
std::condition_variable cv
Definition
event.h:43
Event::mutex
std::mutex mutex
Definition
event.h:44
threading
event.h
Generated on Sun Dec 1 2024 10:42:56 for Luanti by
1.11.0