Cygwin: Add new APIs tc[gs]etwinsize()
[newlib-cygwin.git] / newlib / libc / include / sys / lock.h
blob528904957b55447b9fa2bb567b924f07a1010170
1 #ifndef __SYS_LOCK_H__
2 #define __SYS_LOCK_H__
4 /* dummy lock routines for single-threaded aps */
6 #include <newlib.h>
7 #include <_ansi.h>
9 #if !defined(_RETARGETABLE_LOCKING)
11 typedef int _LOCK_T;
12 typedef int _LOCK_RECURSIVE_T;
14 #define __LOCK_INIT(class,lock) static int lock = 0;
15 #define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0;
16 #define __lock_init(lock) ((void) 0)
17 #define __lock_init_recursive(lock) ((void) 0)
18 #define __lock_close(lock) ((void) 0)
19 #define __lock_close_recursive(lock) ((void) 0)
20 #define __lock_acquire(lock) ((void) 0)
21 #define __lock_acquire_recursive(lock) ((void) 0)
22 #define __lock_try_acquire(lock) ((void) 0)
23 #define __lock_try_acquire_recursive(lock) ((void) 0)
24 #define __lock_release(lock) ((void) 0)
25 #define __lock_release_recursive(lock) ((void) 0)
27 #else
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 struct __lock;
34 typedef struct __lock * _LOCK_T;
35 #define _LOCK_RECURSIVE_T _LOCK_T
37 #define __LOCK_INIT(class,lock) extern struct __lock __lock_ ## lock; \
38 class _LOCK_T lock = &__lock_ ## lock
39 #define __LOCK_INIT_RECURSIVE(class,lock) __LOCK_INIT(class,lock)
41 extern void __retarget_lock_init(_LOCK_T *lock);
42 #define __lock_init(lock) __retarget_lock_init(&lock)
43 extern void __retarget_lock_init_recursive(_LOCK_T *lock);
44 #define __lock_init_recursive(lock) __retarget_lock_init_recursive(&lock)
45 extern void __retarget_lock_close(_LOCK_T lock);
46 #define __lock_close(lock) __retarget_lock_close(lock)
47 extern void __retarget_lock_close_recursive(_LOCK_T lock);
48 #define __lock_close_recursive(lock) __retarget_lock_close_recursive(lock)
49 extern void __retarget_lock_acquire(_LOCK_T lock);
50 #define __lock_acquire(lock) __retarget_lock_acquire(lock)
51 extern void __retarget_lock_acquire_recursive(_LOCK_T lock);
52 #define __lock_acquire_recursive(lock) __retarget_lock_acquire_recursive(lock)
53 extern int __retarget_lock_try_acquire(_LOCK_T lock);
54 #define __lock_try_acquire(lock) __retarget_lock_try_acquire(lock)
55 extern int __retarget_lock_try_acquire_recursive(_LOCK_T lock);
56 #define __lock_try_acquire_recursive(lock) \
57 __retarget_lock_try_acquire_recursive(lock)
58 extern void __retarget_lock_release(_LOCK_T lock);
59 #define __lock_release(lock) __retarget_lock_release(lock)
60 extern void __retarget_lock_release_recursive(_LOCK_T lock);
61 #define __lock_release_recursive(lock) __retarget_lock_release_recursive(lock)
63 #ifdef __cplusplus
65 #endif
67 #endif /* !defined(_RETARGETABLE_LOCKING) */
69 #endif /* __SYS_LOCK_H__ */