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

Method SynchronousOffer

be/src/util/thread-pool.h:323–342  ·  view source on GitHub ↗

Run the provided work item and wait up to 'timeout_milliseconds' for the operation to complete. If it completes, return the status from the work item's Execute() function. Otherwise, return an error status: - THREAD_POOL_TASK_TIMED_OUT if the individual task timed out - THREAD_POOL_SUBMIT_FAILED if all the threads are busy and the task did not even start

Source from the content-addressed store, hash-verified

321 /// - THREAD_POOL_SUBMIT_FAILED if all the threads are busy and the task did not
322 /// even start
323 Status SynchronousOffer(std::shared_ptr<SynchronousWorkItem> work,
324 int64_t timeout_milliseconds) {
325 MonotonicStopWatch offer_timer;
326 offer_timer.Start();
327 bool offer_success = Offer(work, timeout_milliseconds);
328 offer_timer.Stop();
329 if (!offer_success) {
330 // This scenario only happens when all threads are occupied and the queue
331 // is full. This means the system is in a catastrophic state. Log to ERROR.
332 Status failed_to_submit_status =
333 Status(TErrorCode::THREAD_POOL_SUBMIT_FAILED, work->GetDescription(),
334 timeout_milliseconds / MILLIS_PER_SEC);
335 LOG(ERROR) << failed_to_submit_status.GetDetail();
336 return failed_to_submit_status;
337 }
338
339 int64_t time_used_millis =
340 offer_timer.ElapsedTime() / (NANOS_PER_MICRO * MICROS_PER_MILLI);
341 return work->Wait(timeout_milliseconds, time_used_millis);
342 }
343
344 private:
345 static void Worker(int thread_id, const std::shared_ptr<SynchronousWorkItem>& work) {

Callers 2

TESTFunction · 0.80

Calls 7

GetDetailMethod · 0.80
StatusClass · 0.70
StartMethod · 0.45
StopMethod · 0.45
GetDescriptionMethod · 0.45
ElapsedTimeMethod · 0.45
WaitMethod · 0.45

Tested by 1

TESTFunction · 0.64