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

Method BlockingGet

be/src/kudu/rpc/service_queue.cc:42–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool LifoServiceQueue::BlockingGet(std::unique_ptr<InboundCall>* out) {
43 auto consumer = tl_consumer_;
44 if (PREDICT_FALSE(!consumer)) {
45 consumer = tl_consumer_ = new ConsumerState(this);
46 std::lock_guard<simple_spinlock> l(lock_);
47 consumers_.emplace_back(consumer);
48 }
49
50 while (true) {
51 {
52 std::lock_guard<simple_spinlock> l(lock_);
53 if (!queue_.empty()) {
54 auto it = queue_.begin();
55 out->reset(*it);
56 queue_.erase(it);
57 return true;
58 }
59 if (PREDICT_FALSE(shutdown_)) {
60 return false;
61 }
62 consumer->DCheckBoundInstance(this);
63 waiting_consumers_.push_back(consumer);
64 }
65 InboundCall* call = consumer->Wait();
66 if (call != nullptr) {
67 out->reset(call);
68 return true;
69 }
70 // if call == nullptr, this means we are shutting down the queue.
71 // Loop back around and re-check 'shutdown_'.
72 }
73}
74
75QueueStatus LifoServiceQueue::Put(InboundCall* call,
76 std::optional<InboundCall*>* evicted) {

Callers 7

ConsumerThreadFunction · 0.45
ShutdownMethod · 0.45
RunThreadMethod · 0.45
ShutdownMethod · 0.45
RunThreadMethod · 0.45
GetBatchMethod · 0.45
TEST_FFunction · 0.45

Calls 7

eraseMethod · 0.80
DCheckBoundInstanceMethod · 0.80
push_backMethod · 0.80
resetMethod · 0.65
emptyMethod · 0.45
beginMethod · 0.45
WaitMethod · 0.45

Tested by 2

ConsumerThreadFunction · 0.36
TEST_FFunction · 0.36