| 561 | |
| 562 | template <typename U> |
| 563 | TaskManagerID add_task( |
| 564 | std::shared_ptr<TaskRunnerStruct> p_task_runner, |
| 565 | U p_userdata, |
| 566 | const String &p_description, |
| 567 | int progress_steps = -1, |
| 568 | bool p_can_cancel = false, |
| 569 | bool p_high_priority = false, |
| 570 | bool p_progress_enabled = true, |
| 571 | bool p_runs_current_thread = false) { |
| 572 | auto task_id = ++current_task_id; |
| 573 | auto task = std::make_shared<TaskData<U>>(task_id, p_task_runner, p_userdata, p_description, progress_steps, p_can_cancel, p_high_priority, p_progress_enabled, p_runs_current_thread); |
| 574 | task->start(); |
| 575 | bool already_exists = false; |
| 576 | |
| 577 | group_id_to_description.try_emplace_l(task_id, [&](auto &v) { already_exists = true; }, task); |
| 578 | if (already_exists) { |
| 579 | CRASH_COND_MSG(already_exists, "Task already exists?!?!?!"); |
| 580 | } |
| 581 | return task_id; |
| 582 | } |
| 583 | |
| 584 | template <typename U> |
| 585 | Error run_task( |
no test coverage detected