pub(crate) fn maybe_yield() -> bool {
        Self::with(|state| {
            debug_assert!(
                matches!(state.current_task, ScheduledTask::Some(_)) && state.next_task == ScheduledTask::None,
                "we're inside a task and scheduler should not yet have run"
            );

            state.schedule(false);

            // If the next task is the same as the current one, we can skip the context switch
            // and just advance to the next task immediately.
            if state.current_task == state.next_task {
                state.advance_to_next_task();
                false
            } else {
                true
            }
        })
    }
/// Invoke the scheduler to decide which task to schedule next. Returns true if the chosen task
/// is different from the currently running task, indicating that the current task should yield
/// its execution.
Invoke the scheduler to decide which task to schedule next. Returns true if the chosen task
is different from the currently running task, indicating that the current task should yield
its execution.
Invoke the scheduler to decide which task to schedule next . Returns true if the chosen task is different from the currently running task indicating that the current task should yield its execution .
pub(crate) fn maybe_yield() -> bool {
        Self::with(|state| {
            debug_assert!(
                matches!(state.current_task, ScheduledTask::Some(_)) && state.next_task == ScheduledTask::None,
                "we're inside a task and scheduler should not yet have run"
            );
            state.schedule(false);
            // If the next task is the same as the current one, we can skip the context switch
            // and just advance to the next task immediately.
            if state.current_task == state.next_task {
                state.advance_to_next_task();
                false
            } else {
                true
            }
        })
    }
pub ( crate ) fn maybe_yield ( ) -> bool { Self :: with ( | state | { debug_assert ! ( matches ( state current_task ScheduledTask Some ( ) ) state next_task ScheduledTask None " " ) ; state . schedule ( false ) ; // If the next task is the same as the current one, we can skip the context switch // and just advance to the next task immediately. if state . current_task == state . next_task { state . advance_to_next_task ( ) ; false } else { true } } ) }
Invoke the scheduler to decide which task to schedule next.
Invoke the scheduler to decide which task to schedule next .