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

Method BlockingPut

be/src/util/blocking-queue.h:146–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 /// inserted into the queue.
145 template <typename V>
146 bool BlockingPut(V&& val) {
147 MonotonicStopWatch timer;
148 int64_t val_bytes = ElemBytesFn()(val);
149 DCHECK_GE(val_bytes, 0);
150 std::unique_lock<std::mutex> write_lock(put_lock_);
151 while (!HasCapacityInternal(write_lock, val_bytes) && !shutdown_) {
152 if (put_wait_timer_ != nullptr) timer.Start();
153 put_cv_.Wait(write_lock);
154 if (put_wait_timer_ != nullptr) timer.Stop();
155 }
156 if (put_wait_timer_ != nullptr) put_wait_timer_->Add(timer.ElapsedTime());
157 if (UNLIKELY(shutdown_)) return false;
158
159 DCHECK_LT(put_list_.size(), max_elements_);
160 put_bytes_enqueued_ += val_bytes;
161 Put(std::forward<V>(val));
162 write_lock.unlock();
163 get_cv_.NotifyOne();
164 return true;
165 }
166
167 /// Puts an element into the queue, waiting until 'timeout_micros' elapses, if there is
168 /// no space. If the queue is shut down, or if the timeout elapsed without being able to

Callers 5

AddBatchMethod · 0.45
TEST_FFunction · 0.45
OfferMethod · 0.45
TESTFunction · 0.45
InserterThreadMethod · 0.45

Calls 8

NotifyOneMethod · 0.80
StartMethod · 0.45
WaitMethod · 0.45
StopMethod · 0.45
AddMethod · 0.45
ElapsedTimeMethod · 0.45
sizeMethod · 0.45
unlockMethod · 0.45

Tested by 3

TEST_FFunction · 0.36
TESTFunction · 0.36
InserterThreadMethod · 0.36