Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/tokio/src/future/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 693 B image not shown  

Quelle  block_on.rs   Sprache: unbekannt

 
Spracherkennung für: .rs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

use std::future::Future;

cfg_rt! {
    #[track_caller]
    pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
        let mut e = crate::runtime::context::try_enter_blocking_region().expect(
            "Cannot block the current thread from within a runtime. This \
            happens because a function attempted to block the current \
            thread while the thread is being used to drive asynchronous \
            tasks."
        );
        e.block_on(f).unwrap()
    }
}

cfg_not_rt! {
    #[track_caller]
    pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
        let mut park = crate::runtime::park::CachedParkThread::new();
        park.block_on(f).unwrap()
    }
}

[ Dauer der Verarbeitung: 0.27 Sekunden  ]