1- use crate :: { enter, ThreadPool } ;
1+ use crate :: enter;
22use futures_core:: future:: { Future , FutureObj , LocalFutureObj } ;
33use futures_core:: stream:: { Stream } ;
44use futures_core:: task:: {
@@ -8,7 +8,6 @@ use futures_core::task::{
88use futures_util:: task:: { WakerRef , waker_ref, ArcWake } ;
99use futures_util:: stream:: FuturesUnordered ;
1010use futures_util:: stream:: StreamExt ;
11- use lazy_static:: lazy_static;
1211use pin_utils:: pin_mut;
1312use std:: cell:: { RefCell } ;
1413use std:: ops:: { Deref , DerefMut } ;
@@ -192,17 +191,9 @@ impl Default for LocalPool {
192191 }
193192}
194193
195- lazy_static ! {
196- static ref GLOBAL_POOL : ThreadPool = ThreadPool :: builder( )
197- . name_prefix( "block_on-" )
198- . create( )
199- . expect( "Unable to create global thread-pool" ) ;
200- }
201-
202194/// Run a future to completion on the current thread.
203195///
204196/// This function will block the caller until the given future has completed.
205- /// The default spawner for the future is a thread-local executor.
206197///
207198/// Use a [`LocalPool`](LocalPool) if you need finer-grained control over
208199/// spawned tasks.
@@ -215,7 +206,6 @@ pub fn block_on<F: Future>(f: F) -> F::Output {
215206///
216207/// When `next` is called on the resulting `BlockingStream`, the caller
217208/// will be blocked until the next element of the `Stream` becomes available.
218- /// The default spawner for the future is a global `ThreadPool`.
219209pub fn block_on_stream < S : Stream + Unpin > ( stream : S ) -> BlockingStream < S > {
220210 BlockingStream { stream }
221211}
0 commit comments