fn run_executor<T, F: FnMut(&mut Context<'_>) -> Poll<T>>(mut f: F) -> T {
    let _enter = enter().expect(
        "cannot execute `LocalPool` executor from within \
         another executor",
    );

    CURRENT_THREAD_NOTIFY.with(|thread_notify| {
        let waker = waker_ref(thread_notify);
        let mut cx = Context::from_waker(&waker);
        loop {
            if let Poll::Ready(t) = f(&mut cx) {
                return t;
            }

            // Wait for a wakeup.
            while !thread_notify.unparked.swap(false, Ordering::Acquire) {
                // No wakeup occurred. It may occur now, right before parking,
                // but in that case the token made available by `unpark()`
                // is guaranteed to still be available and `park()` is a no-op.
                thread::park();
            }
        }
    })
}
// Set up and run a basic single-threaded spawner loop, invoking `f` on each
// turn.
Set up and run a basic single-threaded spawner loop, invoking `f` on each
turn.
Set up and run a basic single - threaded spawner loop invoking ` f ` on each turn .
fn run_executor<T, F: FnMut(&mut Context<'_>) -> Poll<T>>(mut f: F) -> T {
    let _enter = enter().expect(
        "cannot execute `LocalPool` executor from within \
         another executor",
    );
    CURRENT_THREAD_NOTIFY.with(|thread_notify| {
        let waker = waker_ref(thread_notify);
        let mut cx = Context::from_waker(&waker);
        loop {
            if let Poll::Ready(t) = f(&mut cx) {
                return t;
            }
            // Wait for a wakeup.
            while !thread_notify.unparked.swap(false, Ordering::Acquire) {
                // No wakeup occurred. It may occur now, right before parking,
                // but in that case the token made available by `unpark()`
                // is guaranteed to still be available and `park()` is a no-op.
                thread::park();
            }
        }
    })
}
fn run_executor < T , F : FnMut ( & mut Context < ' _ > ) -> Poll < T > > ( mut f : F ) -> T { let _enter = enter ( ) . expect ( " \
 " , ) ; CURRENT_THREAD_NOTIFY . with ( | thread_notify | { let waker = waker_ref ( thread_notify ) ; let mut cx = Context :: from_waker ( & waker ) ; loop { if let Poll :: Ready ( t ) = f ( & mut cx ) { return t ; } // Wait for a wakeup. while ! thread_notify . unparked . swap ( false , Ordering :: Acquire ) { // No wakeup occurred. It may occur now, right before parking, // but in that case the token made available by `unpark()` // is guaranteed to still be available and `park()` is a no-op. thread :: park ( ) ; } } } ) }
Set up and run a basic single-threaded spawner loop, invoking `f` on each
turn.
Set up and run a basic single - threaded spawner loop invoking ` f ` on each turn .
f
F
f
F