EFL 1.7 svn doobies
[profile/ivi/eina.git] / src / include / eina_inline_lock_void.x
1 /* EINA - EFL data type library
2  * Copyright (C) 2011 Vincent Torri
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library;
16  * if not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef EINA_INLINE_LOCK_VOID_X_
20 #define EINA_INLINE_LOCK_VOID_X_
21
22 #ifdef EINA_UNUSED
23 # undef EINA_UNUSED
24 #endif
25 #ifdef __GNUC__
26 # define EINA_UNUSED __attribute__((unused))
27 #else
28 # define EINA_UNUSED
29 #endif
30
31 /**
32  * @addtogroup Eina_Lock_Group Lock
33  *
34  * @brief These functions provide Mutual Exclusion objects management.
35  *
36  * @note On Windows XP, critical sections are used, while on Windows
37  * CE, standard Mutex objects are used.
38  *
39  * @{
40  */
41
42 /**
43  * @typedef Eina_Lock
44  * Abtract type for a mutual exclusive object.
45  */
46 typedef void *Eina_Lock;
47 typedef void *Eina_RWLock;
48 typedef void *Eina_Condition;
49 typedef void *Eina_TLS;
50 typedef void *Eina_Semaphore;
51
52 /**
53  * @brief Create a new #Eina_Lock.
54  *
55  * @param mutex A pointer to the lock object.
56  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
57  *
58  * This function creates a new #Eina_Lock object and stores it in the
59  * @p mutex buffer. On success, this function returns #EINA_TRUE
60  * and #EINA_FALSE otherwise. To free the resources allocated by this
61  * function, use eina_lock_free(). For performance reasons, no check
62  * is done on @p mutex.
63  */
64 static inline Eina_Bool
65 eina_lock_new(Eina_Lock *mutex EINA_UNUSED)
66 {
67    return EINA_TRUE;
68 }
69
70 /**
71  * @brief Free the ressources of the given lock object.
72  *
73  * @param mutex The lock object to free.
74  *
75  * This function frees the resources of @p mutex allocated by
76  * eina_lock_new(). For performance reasons, no check is done on
77  * @p mutex.
78  */
79 static inline void
80 eina_lock_free(Eina_Lock *mutex EINA_UNUSED)
81 {
82 }
83
84 /**
85  * @brief Lock the given mutual exclusion object.
86  *
87  * @param mutex The lock object to lock.
88  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
89  *
90  * This function locks @p mutex. @p mutex must have been created by
91  * eina_lock_new(). On success, this function returns #EINA_TRUE
92  * and #EINA_FALSE otherwise. For performance reasons, no check is done on
93  * @p mutex.
94  */
95 static inline Eina_Lock_Result
96 eina_lock_take(Eina_Lock *mutex EINA_UNUSED)
97 {
98    return EINA_LOCK_SUCCEED;
99 }
100
101 /**
102  * @brief Try to lock the given mutual exclusion object.
103  *
104  * @param mutex The lock object to try to lock.
105  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
106  *
107  * This function tries to lock @p mutex. @p mutex must have been created by
108  * eina_lock_new(). If @p mutex can be locked, this function returns #EINA_TRUE;
109  * if @p mutex can not be locked, or is already locked, it
110  * returns #EINA_FALSE. This function does not block and returns
111  * immediately. For performance reasons, no check is done on
112  * @p mutex.
113  *
114  * @note On Windows CE, this function is actually eina_lock_take().
115  */
116 static inline Eina_Lock_Result
117 eina_lock_take_try(Eina_Lock *mutex EINA_UNUSED)
118 {
119    return EINA_LOCK_SUCCEED;
120 }
121
122 /**
123  * @brief Unlock the given mutual exclusion object.
124  *
125  * @param mutex The lock object to unlock.
126  * @return #EINA_TRUE on success, #EINA_FALSE otherwise.
127  *
128  * This function unlocks @p mutex. @p mutex must have been created by
129  * eina_lock_new(). On success, this function returns #EINA_TRUE
130  * and #EINA_FALSE otherwise. For performance reasons, no check is
131  * done on @p mutex.
132  */
133 static inline Eina_Lock_Result
134 eina_lock_release(Eina_Lock *mutex EINA_UNUSED)
135 {
136    return EINA_LOCK_SUCCEED;
137 }
138
139 static inline void
140 eina_lock_debug(const Eina_Lock *mutex EINA_UNUSED)
141 {
142 }
143
144 static inline Eina_Bool
145 eina_condition_new(Eina_Condition *cond EINA_UNUSED, Eina_Lock *mutex EINA_UNUSED)
146 {
147    return EINA_TRUE;
148 }
149
150 static inline void
151 eina_condition_free(Eina_Condition *cond EINA_UNUSED)
152 {
153 }
154
155 static inline Eina_Bool
156 eina_condition_wait(Eina_Condition *cond EINA_UNUSED)
157 {
158    return EINA_TRUE;
159 }
160
161 static inline Eina_Bool
162 eina_condition_timedwait(Eina_Condition *cond EINA_UNUSED, double val EINA_UNUSED)
163 {
164    return EINA_TRUE;
165 }
166
167 static inline Eina_Bool
168 eina_condition_broadcast(Eina_Condition *cond EINA_UNUSED)
169 {
170    return EINA_TRUE;
171 }
172
173 static inline Eina_Bool
174 eina_condition_signal(Eina_Condition *cond EINA_UNUSED)
175 {
176    return EINA_TRUE;
177 }
178
179 static inline Eina_Bool
180 eina_rwlock_new(Eina_RWLock *mutex EINA_UNUSED)
181 {
182    return EINA_TRUE;
183 }
184
185 static inline void
186 eina_rwlock_free(Eina_RWLock *mutex EINA_UNUSED)
187 {
188 }
189
190 static inline Eina_Lock_Result
191 eina_rwlock_read_take(Eina_RWLock *mutex EINA_UNUSED)
192 {
193    return EINA_LOCK_SUCCEED;
194 }
195
196 static inline Eina_Lock_Result
197 eina_rwlock_write_take(Eina_RWLock *mutex EINA_UNUSED)
198 {
199    return EINA_LOCK_SUCCEED;
200 }
201
202 static inline Eina_Lock_Result
203 eina_rwlock_release(Eina_RWLock *mutex EINA_UNUSED)
204 {
205    return EINA_LOCK_SUCCEED;
206 }
207
208 static inline Eina_Lock_Result
209 eina_rwlock_take_read(Eina_RWLock *mutex EINA_UNUSED)
210 {
211    return EINA_LOCK_SUCCEED;
212 }
213
214 static inline Eina_Lock_Result
215 eina_rwlock_take_write(Eina_RWLock *mutex EINA_UNUSED)
216 {
217    return EINA_LOCK_SUCCEED;
218 }
219
220 static inline Eina_Bool
221 eina_tls_new(Eina_TLS *key EINA_UNUSED)
222 {
223    return EINA_TRUE;
224 }
225
226 static inline void
227 eina_tls_free(Eina_TLS key EINA_UNUSED)
228 {
229 }
230
231 static inline void *
232 eina_tls_get(Eina_TLS key EINA_UNUSED)
233 {
234    return NULL;
235 }
236
237 static inline Eina_Bool
238 eina_tls_set(Eina_TLS key EINA_UNUSED, const void *data EINA_UNUSED)
239 {
240    return EINA_TRUE;
241 }
242
243 static inline Eina_Bool
244 eina_semaphore_new(Eina_Semaphore *sem EINA_UNUSED,
245                    int count_init EINA_UNUSED)
246 {
247    return EINA_TRUE;
248 }
249
250 static inline Eina_Bool
251 eina_semaphore_free(Eina_Semaphore *sem EINA_UNUSED)
252 {
253    return EINA_TRUE;
254 }
255
256 static inline Eina_Bool
257 eina_semaphore_lock(Eina_Semaphore *sem EINA_UNUSED)
258 {
259    return EINA_TRUE;
260 }
261
262 static inline Eina_Bool
263 eina_semaphore_release(Eina_Semaphore *sem EINA_UNUSED,
264                        int count_release EINA_UNUSED)
265 {
266    return EINA_TRUE;
267 }
268
269 /**
270  * @}
271  */
272
273 #endif