1 /* Copyright (c) 2002 Jeff Johnston <jjohnstn@redhat.com> */ 2 #ifndef __SYS_LOCK_H__ 3 #define __SYS_LOCK_H__ 4 5 /* dummy lock routines for single-threaded aps */ 6 7 #include <newlib.h> 8 #include <_ansi.h> 9 10 #if !defined(_RETARGETABLE_LOCKING) 11 12 typedef int _LOCK_T; 13 typedef int _LOCK_RECURSIVE_T; 14 15 #define __LOCK_INIT(lock) 16 #define __LOCK_INIT_RECURSIVE(lock) 17 #define __lock_init(lock) ((void) 0) 18 #define __lock_init_recursive(lock) ((void) 0) 19 #define __lock_close(lock) ((void) 0) 20 #define __lock_close_recursive(lock) ((void) 0) 21 #define __lock_acquire(lock) ((void) 0) 22 #define __lock_acquire_recursive(lock) ((void) 0) 23 #define __lock_release(lock) ((void) 0) 24 #define __lock_release_recursive(lock) ((void) 0) 25 26 #else 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 struct __lock; 33 typedef struct __lock * _LOCK_T; 34 #define _LOCK_RECURSIVE_T _LOCK_T 35 36 #define __LOCK_INIT(lock) extern struct __lock __lock_ ## lock; 37 #define __LOCK_INIT_RECURSIVE(lock) __LOCK_INIT(lock) 38 39 extern void __retarget_lock_init(_LOCK_T *lock); 40 #define __lock_init(lock) __retarget_lock_init(&lock) 41 extern void __retarget_lock_init_recursive(_LOCK_T *lock); 42 #define __lock_init_recursive(lock) __retarget_lock_init_recursive(&lock) 43 extern void __retarget_lock_close(_LOCK_T lock); 44 #define __lock_close(lock) __retarget_lock_close(lock) 45 extern void __retarget_lock_close_recursive(_LOCK_T lock); 46 #define __lock_close_recursive(lock) __retarget_lock_close_recursive(lock) 47 extern void __retarget_lock_acquire(_LOCK_T lock); 48 #define __lock_acquire(lock) __retarget_lock_acquire(lock) 49 extern void __retarget_lock_acquire_recursive(_LOCK_T lock); 50 #define __lock_acquire_recursive(lock) __retarget_lock_acquire_recursive(lock) 51 extern void __retarget_lock_release(_LOCK_T lock); 52 #define __lock_release(lock) __retarget_lock_release(lock) 53 extern void __retarget_lock_release_recursive(_LOCK_T lock); 54 #define __lock_release_recursive(lock) __retarget_lock_release_recursive(lock) 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif /* !defined(_RETARGETABLE_LOCKING) */ 61 62 #define __LIBC_LOCK() __lock_acquire_recursive(&__lock___libc_recursive_mutex) 63 #define __LIBC_UNLOCK() __lock_release_recursive(&__lock___libc_recursive_mutex) 64 __LOCK_INIT_RECURSIVE(__libc_recursive_mutex) 65 66 #endif /* __SYS_LOCK_H__ */ 67