@@ -38,6 +38,7 @@ mod lock {
3838 IMP_LOCK . lock ( ) ;
3939 }
4040
41+ #[ cfg( feature = "fork" ) ]
4142 pub ( super ) fn release_lock_after_fork_parent ( ) {
4243 if IMP_LOCK . is_locked ( ) && IMP_LOCK . is_owned_by_current_thread ( ) {
4344 unsafe { IMP_LOCK . unlock ( ) } ;
@@ -53,7 +54,7 @@ mod lock {
5354 /// # Safety
5455 ///
5556 /// Must only be called from single-threaded child after fork().
56- #[ cfg( unix ) ]
57+ #[ cfg( feature = "fork" ) ]
5758 pub ( crate ) unsafe fn reinit_after_fork ( ) {
5859 if IMP_LOCK . is_locked ( ) && !IMP_LOCK . is_owned_by_current_thread ( ) {
5960 // Held by a dead thread — reset to unlocked.
@@ -65,7 +66,7 @@ mod lock {
6566 /// behavior in the post-fork child:
6667 /// 1) if ownership metadata is stale (dead owner / changed tid), reset;
6768 /// 2) if current thread owns the lock, release it.
68- #[ cfg( unix ) ]
69+ #[ cfg( feature = "fork" ) ]
6970 pub ( super ) unsafe fn after_fork_child_reinit_and_release ( ) {
7071 unsafe { reinit_after_fork ( ) } ;
7172 if IMP_LOCK . is_locked ( ) && IMP_LOCK . is_owned_by_current_thread ( ) {
@@ -75,22 +76,22 @@ mod lock {
7576}
7677
7778/// Re-export for fork safety code in posix.rs
78- #[ cfg( feature = "threading " ) ]
79+ #[ cfg( feature = "fork " ) ]
7980pub ( crate ) fn acquire_imp_lock_for_fork ( ) {
8081 lock:: acquire_lock_for_fork ( ) ;
8182}
8283
83- #[ cfg( feature = "threading " ) ]
84+ #[ cfg( feature = "fork " ) ]
8485pub ( crate ) fn release_imp_lock_after_fork_parent ( ) {
8586 lock:: release_lock_after_fork_parent ( ) ;
8687}
8788
88- #[ cfg( all ( unix , feature = "threading" ) ) ]
89+ #[ cfg( feature = "fork" ) ]
8990pub ( crate ) unsafe fn reinit_imp_lock_after_fork ( ) {
9091 unsafe { lock:: reinit_after_fork ( ) }
9192}
9293
93- #[ cfg( all ( unix , feature = "threading" ) ) ]
94+ #[ cfg( feature = "fork" ) ]
9495pub ( crate ) unsafe fn after_fork_child_imp_lock_release ( ) {
9596 unsafe { lock:: after_fork_child_reinit_and_release ( ) }
9697}
0 commit comments