Skip to main content

TASK_PRIORITY

Static TASK_PRIORITY 

Source
pub static TASK_PRIORITY: LocalKeyImmutable<Priority>
Expand description

Provides the scheduling priority for the current task.

The priority can influence how the executor schedules the task relative to other tasks. Higher priority tasks may be scheduled more frequently or given preference during execution.

ยงExamples

use some_executor::task::{Task, Configuration, TASK_PRIORITY};
use some_executor::Priority;

let task = Task::without_notifications(
    "priority-check".to_string(),
    Configuration::default(),
    async {
        TASK_PRIORITY.with(|priority| {
            if let Some(p) = priority {
                println!("Task priority: {:?}", p);
            }
        });
    },
);