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

Method WaitUntil

be/src/kudu/util/debug-util.cc:173–195  ·  view source on GitHub ↗

Wait for the flag to be marked as complete, up until the given deadline. Returns true if the flag was marked complete before the deadline.

Source from the content-addressed store, hash-verified

171 // Wait for the flag to be marked as complete, up until the given deadline.
172 // Returns true if the flag was marked complete before the deadline.
173 bool WaitUntil(MonoTime deadline) {
174 if (complete_) return true;
175
176 MonoTime now = MonoTime::Now();
177 while (now < deadline) {
178#ifndef __APPLE__
179 MonoDelta rem = deadline - now;
180 struct timespec ts;
181 rem.ToTimeSpec(&ts);
182 sys_futex(reinterpret_cast<int32_t*>(&complete_),
183 FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
184 0, // wait if value is still 0
185 reinterpret_cast<struct kernel_timespec *>(&ts), nullptr, 0);
186#else
187 sched_yield();
188#endif
189 if (complete_) {
190 return true;
191 }
192 now = MonoTime::Now();
193 }
194 return complete_;
195 }
196
197 void Reset() {
198 complete_ = false;

Callers 2

RevokeSigDataMethod · 0.45
AwaitCollectionMethod · 0.45

Calls 1

ToTimeSpecMethod · 0.80

Tested by

no test coverage detected