@@ -268,7 +268,7 @@ mod async_imp {
268268 }
269269 }
270270
271- /// `fail_point` but with support for async callback.
271+ /// `fail_point` but with support for async callback and pause .
272272 #[ macro_export]
273273 #[ cfg( all( feature = "failpoints" , feature = "async" ) ) ]
274274 macro_rules! async_fail_point {
@@ -373,7 +373,7 @@ mod async_imp {
373373 Task :: Pause => unreachable ! ( ) ,
374374 Task :: Yield => thread:: yield_now ( ) ,
375375 Task :: Delay ( _) => panic ! (
376- "fail does not support async delay, please use a async closure to sleep ."
376+ "fail does not support async delay, please use a async closure to delay ."
377377 ) ,
378378 Task :: Callback ( f) => {
379379 f. run ( ) ;
@@ -612,6 +612,7 @@ impl FailPoint {
612612
613613 fn set_actions ( & self , actions_str : & str , actions : Vec < Action > ) {
614614 loop {
615+ #[ cfg( feature = "async" ) ]
615616 self . async_pause_notify . notify_waiters ( ) ;
616617 // TODO: maybe busy waiting here.
617618 match self . actions . try_write ( ) {
@@ -623,11 +624,9 @@ impl FailPoint {
623624 }
624625 Err ( e) => panic ! ( "unexpected poison: {:?}" , e) ,
625626 }
626- {
627- let mut guard = self . pause . lock ( ) . unwrap ( ) ;
628- * guard = false ;
629- self . pause_notifier . notify_all ( ) ;
630- }
627+ let mut guard = self . pause . lock ( ) . unwrap ( ) ;
628+ * guard = false ;
629+ self . pause_notifier . notify_all ( ) ;
631630 }
632631 }
633632
@@ -674,7 +673,10 @@ impl FailPoint {
674673 Task :: Callback ( f) => {
675674 f. run ( ) ;
676675 }
677- Task :: CallbackAsync ( _) => unreachable ! ( ) ,
676+ #[ cfg( feature = "async" ) ]
677+ Task :: CallbackAsync ( _) => panic ! (
678+ "to use async callback, please enable `async` feature and use `async_fail_point`"
679+ ) ,
678680 }
679681 None
680682 }
@@ -1229,7 +1231,8 @@ mod tests {
12291231 assert_eq ! ( f1( ) , 0 ) ;
12301232 }
12311233
1232- #[ cfg_attr( not( all( feature = "failpoints" , feature = "async" ) ) , ignore) ]
1234+ #[ cfg( feature = "async" ) ]
1235+ #[ cfg_attr( not( feature = "failpoints" ) , ignore) ]
12331236 #[ tokio:: test]
12341237 async fn test_async_failpoint ( ) {
12351238 use std:: time:: Duration ;
0 commit comments