Valkka
1.6.1
OpenSource Video Management
include
event.h
Go to the documentation of this file.
1
#ifndef event_HEADER_GUARD
2
#define event_HEADER_GUARD
3
/*
4
* event.h :
5
*
6
* (c) Copyright 2017-2024 Sampsa Riikonen
7
*
8
* Authors: Sampsa Riikonen <sampsa.riikonen@iki.fi>
9
*
10
* This file is part of the Valkka library.
11
*
12
* Valkka is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU Lesser General Public License as
14
* published by the Free Software Foundation, either version 3 of the
15
* License, or (at your option) any later version.
16
*
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU Lesser General Public License for more details.
21
*
22
* You should have received a copy of the GNU Lesser General Public License
23
* along with this program. If not, see <https://www.gnu.org/licenses/>
24
*
25
*/
26
35
#include <mutex>
36
#include <condition_variable>
37
42
class
Event
{
43
44
public
:
45
Event
();
46
~
Event
();
47
48
public
:
49
void
clear();
50
void
set();
51
bool
is_set();
52
bool
wait(
int
timeout = 0);
53
54
private
:
55
std::mutex mutex;
56
std::condition_variable cv;
57
bool
flag;
58
};
59
#endif
Event
Python-like threading/multiprocessing.Event class.
Definition:
event.h:42
Generated by
1.9.1