dispenso
A library for task parallelism
Loading...
Searching...
No Matches
completion_event.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) Meta Platforms, Inc. and affiliates.
3
*
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
*/
7
14
#pragma once
15
16
#include <dispenso/platform.h>
17
18
#include <dispenso/detail/completion_event_impl.h>
19
20
namespace
dispenso {
21
29
class
CompletionEvent
{
30
public
:
35
void
notify
() {
36
impl_.notify(1);
37
}
38
42
void
wait
()
const
{
43
impl_.wait(1);
44
}
45
49
bool
completed
()
const
{
50
return
impl_.intrusiveStatus().load(std::memory_order_acquire);
51
}
52
59
template
<
class
Rep,
class
Period>
60
bool
waitFor
(
const
std::chrono::duration<Rep, Period>&
relTime
)
const
{
61
return
impl_.waitFor(1,
relTime
);
62
}
63
70
template
<
class
Clock,
class
Duration>
71
bool
waitUntil
(
const
std::chrono::time_point<Clock, Duration>&
absTime
)
const
{
72
return
impl_.waitUntil(1,
absTime
);
73
}
74
79
void
reset
() {
80
impl_.intrusiveStatus().store(0, std::memory_order_seq_cst);
81
}
82
83
private
:
84
detail::CompletionEventImpl impl_{0};
85
};
86
87
}
// namespace dispenso
dispenso::CompletionEvent
Definition
completion_event.h:29
dispenso::CompletionEvent::notify
void notify()
Definition
completion_event.h:35
dispenso::CompletionEvent::completed
bool completed() const
Definition
completion_event.h:49
dispenso::CompletionEvent::wait
void wait() const
Definition
completion_event.h:42
dispenso::CompletionEvent::waitFor
bool waitFor(const std::chrono::duration< Rep, Period > &relTime) const
Definition
completion_event.h:60
dispenso::CompletionEvent::reset
void reset()
Definition
completion_event.h:79
dispenso::CompletionEvent::waitUntil
bool waitUntil(const std::chrono::time_point< Clock, Duration > &absTime) const
Definition
completion_event.h:71
dispenso::OpResult
detail::OpResult< T > OpResult
Definition
pipeline.h:29
dispenso
completion_event.h
Generated by
1.9.8