find_scheduler

Function find_scheduler 

Source
pub fn find_scheduler(name: &str) -> Option<&'static Scheduler>
Expand description

Look up a registered scheduler by its Scheduler::name field (the name = "..." value supplied to declare_scheduler!, not the SCREAMING_SNAKE_CASE const identifier the macro emits). Returns None if no registered scheduler matches.

Two declare_scheduler! invocations that share a name = "..." value (under distinct const idents) both register in KTSTR_SCHEDULERS; a linear scan returns the first match and the second is unreachable. This function panics on the first call when any duplicate exists so the misconfiguration surfaces loudly instead of silently dropping a registration. The scan and map construction happen once per process via a LazyLock.