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

Method BlockingGet

be/src/kudu/util/blocking_queue.h:85–105  ·  view source on GitHub ↗

Gets an element from the queue; if the queue is empty, blocks until the queue becomes non-empty, or until the deadline passes. If the queue has been shut down but there are still elements in the queue, it returns those elements as if the queue were not yet shut down. Returns: - OK if successful - TimedOut if the deadline passed - Aborted if the queue shut down

Source from the content-addressed store, hash-verified

83 // - TimedOut if the deadline passed
84 // - Aborted if the queue shut down
85 Status BlockingGet(T* out, MonoTime deadline = {}) {
86 MutexLock l(lock_);
87 while (true) {
88 if (!queue_.empty()) {
89 *out = std::move(queue_.front());
90 queue_.pop_front();
91 decrement_size_unlocked(*out);
92 l.Unlock();
93 not_full_.Signal();
94 return Status::OK();
95 }
96 if (PREDICT_FALSE(shutdown_)) {
97 return Status::Aborted("");
98 }
99 if (!deadline.Initialized()) {
100 not_empty_.Wait();
101 } else if (PREDICT_FALSE(!not_empty_.WaitUntil(deadline))) {
102 return Status::TimedOut("");
103 }
104 }
105 }
106
107 // Get all elements from the queue and append them to a vector.
108 //

Callers 3

TESTFunction · 0.45
RemoverThreadMethod · 0.45
BlockingGetTaskMethod · 0.45

Calls 11

moveFunction · 0.85
OKFunction · 0.85
AbortedFunction · 0.85
TimedOutFunction · 0.85
frontMethod · 0.80
emptyMethod · 0.45
UnlockMethod · 0.45
SignalMethod · 0.45
InitializedMethod · 0.45
WaitMethod · 0.45
WaitUntilMethod · 0.45

Tested by 3

TESTFunction · 0.36
RemoverThreadMethod · 0.36
BlockingGetTaskMethod · 0.36