MCPcopy Create free account
hub / github.com/apache/impala / WaitForNotification

Method WaitForNotification

be/src/kudu/util/notification.h:77–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 void WaitForNotification() const {
78 while (true) {
79 auto s = base::subtle::Acquire_Load(&state_);
80 if (s == NOT_NOTIFIED_NO_WAITERS) {
81 s = base::subtle::Acquire_CompareAndSwap(
82 &state_, NOT_NOTIFIED_NO_WAITERS, NOT_NOTIFIED_HAS_WAITERS);
83 if (s == NOT_NOTIFIED_NO_WAITERS) {
84 // We succeeded in the CAS -- sets 's' to be the new value of the
85 // state rather than the previous value.
86 s = NOT_NOTIFIED_HAS_WAITERS;
87 }
88 }
89 if (s == NOTIFIED) return;
90 DCHECK_EQ(s, NOT_NOTIFIED_HAS_WAITERS);
91 sys_futex(&state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, NOT_NOTIFIED_HAS_WAITERS,
92 /* timeout */ nullptr, nullptr /* ignored */, 0 /* ignored */);
93 }
94 }
95
96 void Notify() {
97 auto s = base::subtle::Release_AtomicExchange(&state_, NOTIFIED);

Callers 2

TEST_FFunction · 0.80
SyncRequestMethod · 0.80

Calls 3

Acquire_LoadFunction · 0.50
Acquire_CompareAndSwapFunction · 0.50
WaitMethod · 0.45

Tested by 1

TEST_FFunction · 0.64