MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / pollster_block_on

Function pollster_block_on

native/ios/src/lib.rs:629–646  ·  view source on GitHub ↗
(future: F)

Source from the content-addressed store, hash-verified

627// ============================================================
628
629fn pollster_block_on<F: std::future::Future>(future: F) -> F::Output {
630 use std::task::{Context, Poll, Wake, Waker};
631 use std::pin::Pin;
632 use std::sync::Arc;
633 struct NoopWaker;
634 impl Wake for NoopWaker { fn wake(self: Arc<Self>) {} }
635 let waker = Waker::from(Arc::new(NoopWaker));
636 let mut cx = Context::from_waker(&waker);
637 let mut future = unsafe { Pin::new_unchecked(Box::new(future)) };
638 loop {
639 match future.as_mut().poll(&mut cx) {
640 Poll::Ready(result) => return result,
641 Poll::Pending => {
642 pump_run_loop(0.001);
643 }
644 }
645 }
646}
647
648// ============================================================
649// FFI entry points

Callers 2

scene_will_connectFunction · 0.70
perry_scene_will_connectFunction · 0.70

Calls 1

pump_run_loopFunction · 0.70

Tested by

no test coverage detected