Skip to main content

luaur_analyze_cli/methods/
task_scheduler_push.rs

1use crate::records::task_scheduler::{Task, TaskScheduler};
2
3/// `void push(std::function<void()> task)` (`CLI/src/Analyze.cpp:365-373`):
4///
5/// ```cpp
6/// {
7///     std::unique_lock guard(mtx);
8///     tasks.push(std::move(task));
9/// }
10/// cv.notify_one();
11/// ```
12#[allow(non_snake_case)]
13pub fn task_scheduler_push(this: &TaskScheduler, task: Task) {
14    {
15        let mut guard = this.tasks.mtx.lock().unwrap();
16        guard.push_back(task);
17    }
18
19    this.tasks.cv.notify_one();
20}