MCPcopy Create free account
hub / github.com/baidu/tera / DelayTask

Method DelayTask

src/common/thread_pool.h:95–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 work_cv_.Signal();
94 }
95 int64_t DelayTask(int64_t delay, const Task& task) {
96 MutexLock lock(&mutex_);
97 int64_t now_time = get_micros();
98 int64_t exe_time = now_time + delay * 1000;
99 BGItem bg_item(++last_task_id_, exe_time, task);
100 time_queue_.push(bg_item);
101 latest_[bg_item.id] = bg_item;
102 work_cv_.Signal();
103 return bg_item.id;
104 }
105 /// Cancel a delayed task
106 /// if running, wait if non_block==false; return immediately if
107 /// non_block==true

Callers 15

ScheduleMetaBalanceMethod · 0.80
ScheduleUnityBalanceMethod · 0.80
DistributeDelayTasksMethod · 0.80
ScanMetaTableAsyncMethod · 0.80
ScanMetaTableCallBackMethod · 0.80
ScheduleUpdateMetaMethod · 0.80
ReadTableMetaAsyncMethod · 0.80
ReadTableMetaCallBackMethod · 0.80
AddDelayTaskMethod · 0.80
TableImplMethod · 0.80
PrintStatusMethod · 0.80

Calls 2

get_microsFunction · 0.70
SignalMethod · 0.45

Tested by 5

TEST_FFunction · 0.64
AddDelayTaskMethod · 0.64
TESTFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64