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

Method PopTask

src/sdk/sdk_task.cc:140–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140SdkTask* SdkTimeoutManager::PopTask(int64_t task_id) {
141 uint32_t shard_id = Shard(task_id);
142 TaskMap& map = map_shard_[shard_id];
143 Mutex& mutex = mutex_shard_[shard_id];
144
145 MutexLock l(&mutex);
146 IdHashMap::iterator it = map.id_hash_map.find(task_id);
147 if (it != map.id_hash_map.end()) {
148 SdkTask* task = it->second;
149 CHECK_EQ(task->GetId(), task_id);
150 map.id_hash_map.erase(it);
151 // make sure that we only erased the right one element
152 assert(map.due_time_map.erase(task) == 1);
153 return task;
154 } else {
155 return NULL;
156 }
157}
158
159void SdkTimeoutManager::CheckTimeout() {
160 int64_t now_ms = get_millis();

Callers 7

ScanCallBackMethod · 0.80
BatchMutateCallBackMethod · 0.80
MutateCallBackMethod · 0.80
ReaderCallBackMethod · 0.80
BreakRequestMethod · 0.80
TEST_FFunction · 0.80
PopTaskFuncFunction · 0.80

Calls 1

GetIdMethod · 0.45

Tested by 2

TEST_FFunction · 0.64
PopTaskFuncFunction · 0.64