Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / misc / lock.c
blobc03c36a1e4c08c84b53b7a84ae3bc7ff8a1da626
1 /*
2 FUNCTION
3 <<__retarget_lock_init>>, <<__retarget_lock_init_recursive>>, <<__retarget_lock_close>>, <<__retarget_lock_close_recursive>>, <<__retarget_lock_acquire>>, <<__retarget_lock_acquire_recursive>>, <<__retarget_lock_try_acquire>>, <<__retarget_lock_try_acquire_recursive>>, <<__retarget_lock_release>>, <<__retarget_lock_release_recursive>>---locking routines
5 INDEX
6 __lock___sfp_recursive_mutex
7 INDEX
8 __lock___atexit_recursive_mutex
9 INDEX
10 __lock___at_quick_exit_mutex
11 INDEX
12 __lock___malloc_recursive_mutex
13 INDEX
14 __lock___env_recursive_mutex
15 INDEX
16 __lock___tz_mutex
17 INDEX
18 __lock___dd_hash_mutex
19 INDEX
20 __lock___arc4random_mutex
22 INDEX
23 __retarget_lock_init
24 INDEX
25 __retarget_lock_init_recursive
26 INDEX
27 __retarget_lock_close
28 INDEX
29 __retarget_lock_close_recursive
30 INDEX
31 __retarget_lock_acquire
32 INDEX
33 __retarget_lock_acquire_recursive
34 INDEX
35 __retarget_lock_try_acquire
36 INDEX
37 __retarget_lock_try_acquire_recursive
38 INDEX
39 __retarget_lock_release
40 INDEX
41 __retarget_lock_release_recursive
43 SYNOPSIS
44 #include <lock.h>
45 struct __lock __lock___sfp_recursive_mutex;
46 struct __lock __lock___atexit_recursive_mutex;
47 struct __lock __lock___at_quick_exit_mutex;
48 struct __lock __lock___malloc_recursive_mutex;
49 struct __lock __lock___env_recursive_mutex;
50 struct __lock __lock___tz_mutex;
51 struct __lock __lock___dd_hash_mutex;
52 struct __lock __lock___arc4random_mutex;
54 void __retarget_lock_init (_LOCK_T * <[lock_ptr]>);
55 void __retarget_lock_init_recursive (_LOCK_T * <[lock_ptr]>);
56 void __retarget_lock_close (_LOCK_T <[lock]>);
57 void __retarget_lock_close_recursive (_LOCK_T <[lock]>);
58 void __retarget_lock_acquire (_LOCK_T <[lock]>);
59 void __retarget_lock_acquire_recursive (_LOCK_T <[lock]>);
60 int __retarget_lock_try_acquire (_LOCK_T <[lock]>);
61 int __retarget_lock_try_acquire_recursive (_LOCK_T <[lock]>);
62 void __retarget_lock_release (_LOCK_T <[lock]>);
63 void __retarget_lock_release_recursive (_LOCK_T <[lock]>);
65 DESCRIPTION
66 Newlib was configured to allow the target platform to provide the locking
67 routines and static locks at link time. As such, a dummy default
68 implementation of these routines and static locks is provided for
69 single-threaded application to link successfully out of the box on bare-metal
70 systems.
72 For multi-threaded applications the target platform is required to provide
73 an implementation for @strong{all} these routines and static locks. If some
74 routines or static locks are missing, the link will fail with doubly defined
75 symbols.
77 PORTABILITY
78 These locking routines and static lock are newlib-specific. Supporting OS
79 subroutines are required for linking multi-threaded applications.
82 /* dummy lock routines and static locks for single-threaded apps */
84 #ifndef __SINGLE_THREAD__
86 #include <sys/lock.h>
88 struct __lock {
89 char unused;
92 struct __lock __lock___sfp_recursive_mutex;
93 struct __lock __lock___atexit_recursive_mutex;
94 struct __lock __lock___at_quick_exit_mutex;
95 struct __lock __lock___malloc_recursive_mutex;
96 struct __lock __lock___env_recursive_mutex;
97 struct __lock __lock___tz_mutex;
98 struct __lock __lock___dd_hash_mutex;
99 struct __lock __lock___arc4random_mutex;
101 void
102 __retarget_lock_init (_LOCK_T *lock)
106 void
107 __retarget_lock_init_recursive(_LOCK_T *lock)
111 void
112 __retarget_lock_close(_LOCK_T lock)
116 void
117 __retarget_lock_close_recursive(_LOCK_T lock)
121 void
122 __retarget_lock_acquire (_LOCK_T lock)
126 void
127 __retarget_lock_acquire_recursive (_LOCK_T lock)
132 __retarget_lock_try_acquire(_LOCK_T lock)
134 return 1;
138 __retarget_lock_try_acquire_recursive(_LOCK_T lock)
140 return 1;
143 void
144 __retarget_lock_release (_LOCK_T lock)
148 void
149 __retarget_lock_release_recursive (_LOCK_T lock)
153 #endif /* !defined(__SINGLE_THREAD__) */