pub fn r#yield() {
    assert!(initialized(), "yield() called before scheduler initialized");

    'switched: loop {
        // Wait for the preempt lock.
        let preempt_lock = global_state().preempt_lock.lock();

        // Allow pending interrupts to run.
        unsafe { interrupt::accept(); }

        let next_process;

        // Get a process that we're allowed to run
        'got_process: loop {
            if let Some(next) = pop_running() {
                // Ready process on queue
                next_process = next;
                break 'got_process;
            } else if let Some(current) =
                    Some(process::current()).filter(|p| p.lock().is_running()) {
                // Current process can be run
                next_process = current;
                break 'got_process;
            } else {
                // Maybe something will change if we wait for an interrupt.
                unsafe { interrupt::wait(); }
            }
        }

        drop(preempt_lock);

        // It can be very important to make sure that we drop any reference
        // counted pointers we are holding onto before we do this, as it's
        // possible that we may never return from this...

        // Try to switch, loop again if we couldn't.
        if switch(next_process) {
            break 'switched;
        }
    }
}
/// Iterates the scheduler loop so that other processes may execute.
///
/// If no other processes are ready to execute, and the current process is still
/// ready for execution, control will be returned to the current process
/// immediately.
///
/// If no processes are ready for execution, `tick()` will halt the processor
/// and accept interrupts until a process is ready.
///
/// # Panics
///
/// Panics if the scheduler has not been initialized.
Iterates the scheduler loop so that other processes may execute.
If no other processes are ready to execute, and the current process is still
ready for execution, control will be returned to the current process
immediately.

If no processes are ready for execution, `tick()` will halt the processor
and accept interrupts until a process is ready.
Iterates the scheduler loop so that other processes may execute . If no other processes are ready to execute and the current process is still ready for execution control will be returned to the current process immediately . If no processes are ready for execution ` tick () ` will halt the processor and accept interrupts until a process is ready .
pub fn r#yield() {
    assert!(initialized(), "yield() called before scheduler initialized");
    'switched: loop {
        // Wait for the preempt lock.
        let preempt_lock = global_state().preempt_lock.lock();
        // Allow pending interrupts to run.
        unsafe { interrupt::accept(); }
        let next_process;
        // Get a process that we're allowed to run
        'got_process: loop {
            if let Some(next) = pop_running() {
                // Ready process on queue
                next_process = next;
                break 'got_process;
            } else if let Some(current) =
                    Some(process::current()).filter(|p| p.lock().is_running()) {
                // Current process can be run
                next_process = current;
                break 'got_process;
            } else {
                // Maybe something will change if we wait for an interrupt.
                unsafe { interrupt::wait(); }
            }
        }
        drop(preempt_lock);
        // It can be very important to make sure that we drop any reference
        // counted pointers we are holding onto before we do this, as it's
        // possible that we may never return from this...
        // Try to switch, loop again if we couldn't.
        if switch(next_process) {
            break 'switched;
        }
    }
}
pub fn r#yield ( ) { assert ! ( initialized ( ) " " ) ; ' switched : loop { // Wait for the preempt lock. let preempt_lock = global_state ( ) . preempt_lock . lock ( ) ; // Allow pending interrupts to run. unsafe { interrupt :: accept ( ) ; } let next_process ; // Get a process that we're allowed to run ' got_process : loop { if let Some ( next ) = pop_running ( ) { // Ready process on queue next_process = next ; break ' got_process ; } else if let Some ( current ) = Some ( process :: current ( ) ) . filter ( | p | p . lock ( ) . is_running ( ) ) { // Current process can be run next_process = current ; break ' got_process ; } else { // Maybe something will change if we wait for an interrupt. unsafe { interrupt :: wait ( ) ; } } } drop ( preempt_lock ) ; // It can be very important to make sure that we drop any reference // counted pointers we are holding onto before we do this, as it's // possible that we may never return from this... // Try to switch, loop again if we couldn't. if switch ( next_process ) { break ' switched ; } } }
Iterates the scheduler loop so that other processes may execute.
Iterates the scheduler loop so that other processes may execute .
panics
Panics if the scheduler has not been initialized.
Panics if the scheduler has not been initialized .