pub fn preempt() -> bool {
    if !initialized() { return false; }

    let next_process;

    if let Some(preempt_lock) = global_state().preempt_lock.try_lock() {
        if let Some(next) = pop_running() {
            next_process = next;
        } else {
            return false;
        }

        drop(preempt_lock);
    } else {
        return false;
    }

    switch(next_process)
}
/// A weaker version of [r#yield], which will return immediately if:
///
/// 1. the preempt lock can't be acquired
/// 2. there are no other processes waiting
/// 3. or the scheduler hasn't been initialized yet.
///
/// This is intended to be called by the timer to enable timesharing.
///
/// Returns true if a switch occurred.
A weaker version of [r#yield], which will return immediately if:
1. the preempt lock can't be acquired
2. there are no other processes waiting
3. or the scheduler hasn't been initialized yet.

This is intended to be called by the timer to enable timesharing.

Returns true if a switch occurred.
A weaker version of [ r#yield ] which will return immediately if : 1 . the preempt lock can ' t be acquired 2 . there are no other processes waiting 3 . or the scheduler hasn ' t been initialized yet . This is intended to be called by the timer to enable timesharing . Returns true if a switch occurred .
pub fn preempt() -> bool {
    if !initialized() { return false; }
    let next_process;
    if let Some(preempt_lock) = global_state().preempt_lock.try_lock() {
        if let Some(next) = pop_running() {
            next_process = next;
        } else {
            return false;
        }
        drop(preempt_lock);
    } else {
        return false;
    }
    switch(next_process)
}
pub fn preempt ( ) -> bool { if ! initialized ( ) { return false ; } let next_process ; if let Some ( preempt_lock ) = global_state ( ) . preempt_lock . try_lock ( ) { if let Some ( next ) = pop_running ( ) { next_process = next ; } else { return false ; } drop ( preempt_lock ) ; } else { return false ; } switch ( next_process ) }
A weaker version of [r#yield], which will return immediately if:
1. the preempt lock can't be acquired
2. there are no other processes waiting
3. or the scheduler hasn't been initialized yet.
A weaker version of [ r#yield ] which will return immediately if : 1 . the preempt lock can ' t be acquired 2 . there are no other processes waiting 3 . or the scheduler hasn ' t been initialized yet .