1 #include "stdio_impl.h" 2 #include <pthread.h> 3 4 static FILE *ofl_head; 5 6 static pthread_mutex_t locallock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; 7 LOCK(void)8static int LOCK(void) 9 { 10 return pthread_mutex_lock(&locallock); 11 } 12 UNLOCK(void)13static void UNLOCK(void) 14 { 15 (void)pthread_mutex_unlock(&locallock); 16 } 17 18 __ofl_lock()19FILE **__ofl_lock() 20 { 21 LOCK(); 22 return &ofl_head; 23 } 24 __ofl_unlock()25void __ofl_unlock() 26 { 27 UNLOCK(); 28 } 29