@@ -605,24 +605,27 @@ impl SyncHandle {
605605
606606impl Drop for SyncHandle {
607607 fn drop ( & mut self ) {
608- #[ cfg( wasm_browser) ]
609- {
610- let tx = self . tx . clone ( ) ;
611- n0_future:: task:: spawn ( async move {
612- tx. send ( Action :: Shutdown { reply : None } ) . await . ok ( ) ;
613- } ) ;
614- }
615608 // this means we're dropping the last reference
616- #[ cfg ( not ( wasm_browser ) ) ]
609+ #[ allow ( unused ) ]
617610 if let Some ( handle) = Arc :: get_mut ( & mut self . join_handle ) {
618- // this call is the reason tx can not be a tokio mpsc channel.
619- // we have no control about where drop is called, yet tokio send_blocking panics
620- // when called from inside a tokio runtime.
621- self . tx . send_blocking ( Action :: Shutdown { reply : None } ) . ok ( ) ;
622- let handle = handle. take ( ) . expect ( "this can only run once" ) ;
623-
624- if let Err ( err) = handle. join ( ) {
625- warn ! ( ?err, "Failed to join sync actor" ) ;
611+ #[ cfg( wasm_browser) ]
612+ {
613+ let tx = self . tx . clone ( ) ;
614+ n0_future:: task:: spawn ( async move {
615+ tx. send ( Action :: Shutdown { reply : None } ) . await . ok ( ) ;
616+ } ) ;
617+ }
618+ #[ cfg( not( wasm_browser) ) ]
619+ {
620+ // this call is the reason tx can not be a tokio mpsc channel.
621+ // we have no control about where drop is called, yet tokio send_blocking panics
622+ // when called from inside a tokio runtime.
623+ self . tx . send_blocking ( Action :: Shutdown { reply : None } ) . ok ( ) ;
624+ let handle = handle. take ( ) . expect ( "this can only run once" ) ;
625+
626+ if let Err ( err) = handle. join ( ) {
627+ warn ! ( ?err, "Failed to join sync actor" ) ;
628+ }
626629 }
627630 }
628631 }
0 commit comments