@@ -88,7 +88,7 @@ impl_hook!(RENAMEAT2, renameat2(olddirfd: c_int, oldpath: *const c_char, newdirf
8888// first-time initialisation of any Lazy<CHAIN> static. The flag detects that situation
8989// and falls through to the real system function, breaking the cycle.
9090thread_local ! {
91- static PTHREAD_MUTEX_HOOK_DEPTH : Cell <bool > = const { Cell :: new( false ) } ;
91+ static PTHREAD_MUTEX_IN_HOOK : Cell <bool > = const { Cell :: new( false ) } ;
9292}
9393
9494// Store function pointers as plain atomics so that loading them never requires a mutex.
@@ -119,10 +119,10 @@ pub extern "C" fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int {
119119 // If already executing inside this hook (e.g., once_cell or std::sync internals call
120120 // pthread_mutex_lock while the hook chain is being initialised), use the real function
121121 // directly to avoid infinite recursion.
122- if PTHREAD_MUTEX_HOOK_DEPTH . with ( Cell :: get) {
122+ if PTHREAD_MUTEX_IN_HOOK . with ( Cell :: get) {
123123 return fn_ptr ( lock) ;
124124 }
125- PTHREAD_MUTEX_HOOK_DEPTH . with ( |b| b. set ( true ) ) ;
125+ PTHREAD_MUTEX_IN_HOOK . with ( |b| b. set ( true ) ) ;
126126
127127 let result = if crate :: hook ( )
128128 || open_coroutine_core:: scheduler:: SchedulableCoroutine :: current ( ) . is_some ( )
@@ -133,7 +133,7 @@ pub extern "C" fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int {
133133 fn_ptr ( lock)
134134 } ;
135135
136- PTHREAD_MUTEX_HOOK_DEPTH . with ( |b| b. set ( false ) ) ;
136+ PTHREAD_MUTEX_IN_HOOK . with ( |b| b. set ( false ) ) ;
137137 result
138138}
139139
@@ -157,10 +157,10 @@ pub extern "C" fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int {
157157
158158 // Same guard as pthread_mutex_lock – once_cell may call pthread_mutex_unlock while
159159 // unlocking its internal mutex during hook-chain initialisation.
160- if PTHREAD_MUTEX_HOOK_DEPTH . with ( Cell :: get) {
160+ if PTHREAD_MUTEX_IN_HOOK . with ( Cell :: get) {
161161 return fn_ptr ( lock) ;
162162 }
163- PTHREAD_MUTEX_HOOK_DEPTH . with ( |b| b. set ( true ) ) ;
163+ PTHREAD_MUTEX_IN_HOOK . with ( |b| b. set ( true ) ) ;
164164
165165 let result = if crate :: hook ( )
166166 || open_coroutine_core:: scheduler:: SchedulableCoroutine :: current ( ) . is_some ( )
@@ -171,7 +171,7 @@ pub extern "C" fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int {
171171 fn_ptr ( lock)
172172 } ;
173173
174- PTHREAD_MUTEX_HOOK_DEPTH . with ( |b| b. set ( false ) ) ;
174+ PTHREAD_MUTEX_IN_HOOK . with ( |b| b. set ( false ) ) ;
175175 result
176176}
177177
0 commit comments