MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / wait_for_task_completion

Method wait_for_task_completion

utility/task_manager.cpp:256–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254TaskManager::BaseTemplateTaskData::~BaseTemplateTaskData() {}
255
256Error TaskManager::wait_for_task_completion(TaskManagerID p_group_id, uint64_t timeout_s_no_progress) {
257 if (p_group_id == -1) {
258 return ERR_INVALID_PARAMETER;
259 }
260 Error err = OK;
261 bool erase = true;
262 {
263 std::shared_ptr<BaseTemplateTaskData> task;
264 bool already_waiting = false;
265 bool found = group_id_to_description.modify_if(p_group_id, [&](auto &v) {
266 task = v.second;
267 already_waiting = task->is_waiting;
268 if (!already_waiting) {
269 task->is_waiting = true;
270 }
271 });
272 if (!task || !found) {
273 return ERR_INVALID_PARAMETER;
274 } else if (already_waiting) {
275 return ERR_ALREADY_IN_USE;
276 }
277 if (task->wait_for_completion(timeout_s_no_progress)) {
278 if (task->is_timed_out()) {
279 err = ERR_TIMEOUT;
280 } else {
281 err = ERR_SKIP;
282 }
283 if (task->_is_aborted()) {
284 erase = false;
285 task->is_waiting = false;
286 err = ERR_LOCKED;
287 }
288 }
289 }
290 if (erase) {
291 group_id_to_description.erase(p_group_id);
292 }
293 return err;
294}
295
296bool TaskManager::wait_until_next_frame(int64_t p_time_usec) {
297 uint64_t curr_time = OS::get_singleton()->get_ticks_usec();

Callers 7

list_dirMethod · 0.80
export_importsMethod · 0.80
list_dirMethod · 0.80
batch_export_filesMethod · 0.80

Calls 10

modify_ifMethod · 0.80
is_timed_outMethod · 0.80
_is_abortedMethod · 0.80
is_startedMethod · 0.80
wait_until_next_frameMethod · 0.80
get_download_errorMethod · 0.80
wait_for_completionMethod · 0.45
eraseMethod · 0.45
is_canceledMethod · 0.45
is_doneMethod · 0.45

Tested by

no test coverage detected