18 #ifndef FOEDUS_THREAD_RENDEZVOUS_IMPL_HPP_
19 #define FOEDUS_THREAD_RENDEZVOUS_IMPL_HPP_
77 template<
class REP,
class PERIOD>
78 bool wait_for(
const std::chrono::duration<REP, PERIOD>& timeout) {
91 template<
class CLOCK,
class DURATION >
92 bool wait_until(
const std::chrono::time_point<CLOCK, DURATION>& until) {
108 condition_.
notify_all([
this]{ signaled_.store(
true); });
116 return signaled_.load();
120 return signaled_.load(std::memory_order_relaxed);
127 std::atomic<bool> signaled_;
133 #endif // FOEDUS_THREAD_RENDEZVOUS_IMPL_HPP_
void notify_all(SIGNAL_ACTION signal_action)
Notify all waiters that the event has happened.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
bool is_signaled() const
returns whether this thread has stopped (if the thread hasn't started, false too).
void wait()
Block until the event happens.
The frequently appearing triplet of condition_varible, "signal" flag for spurious wakeup...
void signal()
Notify all waiters that the event has happened.
bool wait_for(const std::chrono::duration< REP, PERIOD > &timeout, PREDICATE predicate)
Block until the event happens or the given period elapses.
Rendezvous & operator=(const Rendezvous &other)=delete
bool wait_until(const std::chrono::time_point< CLOCK, DURATION > &until)
Block until the event happens or the given time point arrives.
An analogue of pthread's condition variable and std::condition_variable to avoid glibc's bug in pthre...
bool wait_until(const std::chrono::time_point< CLOCK, DURATION > &until, PREDICATE predicate)
Block until the event happens or the given time point arrives.
void wait(PREDICATE predicate)
Block until the event happens.
bool wait_for(const std::chrono::duration< REP, PERIOD > &timeout)
Block until the event happens or the given period elapses.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
bool is_signaled_weak() const
non-atomic is_signaled().