Home
libucxx
libucxx
ucxx
nightly (0.53)
nightly (0.53)
stable (0.52)
legacy (0.51)
Toggle main menu visibility
Loading...
Searching...
No Matches
include
ucxx
utils
callback_notifier.h
1
5
#include <atomic>
6
#include <condition_variable>
7
#include <mutex>
8
namespace
ucxx
{
9
10
namespace
utils {
11
18
class
CallbackNotifier
{
19
private
:
20
std::atomic_bool _flag{};
//< flag storing state
21
std::mutex _mutex{};
//< lock to guard accesses
22
std::condition_variable _conditionVariable{};
//< notification condition var
23
24
public
:
39
CallbackNotifier
() : _flag{false} {};
40
41
~CallbackNotifier
() =
default
;
42
43
CallbackNotifier
(
const
CallbackNotifier
&) =
delete
;
44
CallbackNotifier
& operator=(
CallbackNotifier
const
&) =
delete
;
45
CallbackNotifier
(
CallbackNotifier
&& o) =
delete
;
46
CallbackNotifier
& operator=(
CallbackNotifier
&& o) =
delete
;
47
54
void
set
();
55
74
bool
wait
(uint64_t period = 0,
75
std::function<
void
(
void
)> signalWorkerFunction =
nullptr
,
76
uint64_t signalRerun = 100000000);
77
};
78
79
}
// namespace utils
80
}
// namespace ucxx
ucxx::utils::CallbackNotifier
Definition
callback_notifier.h:18
ucxx::utils::CallbackNotifier::wait
bool wait(uint64_t period=0, std::function< void(void)> signalWorkerFunction=nullptr, uint64_t signalRerun=100000000)
Wait until set() has been called or period has elapsed.
ucxx::utils::CallbackNotifier::set
void set()
Notify waiting threads that we are done and they can proceed.
ucxx::utils::CallbackNotifier::CallbackNotifier
CallbackNotifier()
Construct a thread-safe notification object.
Definition
callback_notifier.h:39
ucxx
Definition
address.h:16
Generated by
1.18.0