File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use std:: future:: Future ;
22use std:: panic:: catch_unwind;
3+ use std:: sync:: OnceLock ;
34use std:: thread;
45
56use async_executor:: { Executor , Task } ;
67use async_io:: block_on;
7- use async_lock:: OnceCell ;
88use futures_lite:: future;
99
1010/// Spawns a task onto the global executor (single-threaded by default).
@@ -31,10 +31,10 @@ use futures_lite::future;
3131/// });
3232/// ```
3333pub fn spawn < T : Send + ' static > ( future : impl Future < Output = T > + Send + ' static ) -> Task < T > {
34- static GLOBAL : OnceCell < Executor < ' _ > > = OnceCell :: new ( ) ;
34+ static GLOBAL : OnceLock < Executor < ' _ > > = OnceLock :: new ( ) ;
3535
3636 fn global ( ) -> & ' static Executor < ' static > {
37- GLOBAL . get_or_init_blocking ( || {
37+ GLOBAL . get_or_init ( || {
3838 let num_threads = {
3939 // Parse SMOL_THREADS or default to 1.
4040 std:: env:: var ( "SMOL_THREADS" )
You can’t perform that action at this time.
0 commit comments