diff options
author | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2012-10-10 20:24:45 +0000 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2012-10-10 20:24:45 +0000 |
commit | a6acf1b2d0f219676366cba73bfff9da4bba04fd (patch) | |
tree | e9900cfd630c7ae443165b35e007a8e08f60e882 /src | |
parent | a3d116ab37d8c0e611ae799c21b75965ea8c0416 (diff) |
efl: simplify threads step 1 - make it mandatory.
remove the eina_inline_lock_void.x fallback as it's not used anymore.
still keep the EINA_HAVE_THREADS in the source code.
SVN revision: 77796
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/eina/Makefile.am | 4 | ||||
-rw-r--r-- | src/lib/eina/eina_inline_lock_void.x | 264 | ||||
-rw-r--r-- | src/lib/eina/eina_lock.h | 14 |
3 files changed, 5 insertions, 277 deletions
diff --git a/src/lib/eina/Makefile.am b/src/lib/eina/Makefile.am index 0797f89d72..c3eb252f50 100644 --- a/src/lib/eina/Makefile.am +++ b/src/lib/eina/Makefile.am | |||
@@ -87,7 +87,6 @@ eina_inline_value.x | |||
87 | # eina_model.h | 87 | # eina_model.h |
88 | # eina_object.h | 88 | # eina_object.h |
89 | 89 | ||
90 | if EINA_HAVE_THREADS | ||
91 | if HAVE_WINCE | 90 | if HAVE_WINCE |
92 | EINAHEADERS += eina_inline_lock_wince.x | 91 | EINAHEADERS += eina_inline_lock_wince.x |
93 | else | 92 | else |
@@ -97,9 +96,6 @@ else | |||
97 | EINAHEADERS += eina_inline_lock_posix.x | 96 | EINAHEADERS += eina_inline_lock_posix.x |
98 | endif | 97 | endif |
99 | endif | 98 | endif |
100 | else | ||
101 | EINAHEADERS += eina_inline_lock_void.x | ||
102 | endif | ||
103 | 99 | ||
104 | installed_mainheaderdir = $(includedir)/eina-@VMAJ@ | 100 | installed_mainheaderdir = $(includedir)/eina-@VMAJ@ |
105 | dist_installed_mainheader_DATA = Eina.h eina_config.h | 101 | dist_installed_mainheader_DATA = Eina.h eina_config.h |
diff --git a/src/lib/eina/eina_inline_lock_void.x b/src/lib/eina/eina_inline_lock_void.x deleted file mode 100644 index 1d1b5d4647..0000000000 --- a/src/lib/eina/eina_inline_lock_void.x +++ /dev/null | |||
@@ -1,264 +0,0 @@ | |||
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 | /** | ||
23 | * @addtogroup Eina_Lock_Group Lock | ||
24 | * | ||
25 | * @brief These functions provide Mutual Exclusion objects management. | ||
26 | * | ||
27 | * @note On Windows XP, critical sections are used, while on Windows | ||
28 | * CE, standard Mutex objects are used. | ||
29 | * | ||
30 | * @{ | ||
31 | */ | ||
32 | |||
33 | /** | ||
34 | * @typedef Eina_Lock | ||
35 | * Abtract type for a mutual exclusive object. | ||
36 | */ | ||
37 | typedef void *Eina_Lock; | ||
38 | typedef void *Eina_RWLock; | ||
39 | typedef void *Eina_Condition; | ||
40 | typedef void *Eina_TLS; | ||
41 | typedef void *Eina_Semaphore; | ||
42 | |||
43 | /** | ||
44 | * @brief Create a new #Eina_Lock. | ||
45 | * | ||
46 | * @param mutex A pointer to the lock object. | ||
47 | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | ||
48 | * | ||
49 | * This function creates a new #Eina_Lock object and stores it in the | ||
50 | * @p mutex buffer. On success, this function returns #EINA_TRUE | ||
51 | * and #EINA_FALSE otherwise. To free the resources allocated by this | ||
52 | * function, use eina_lock_free(). For performance reasons, no check | ||
53 | * is done on @p mutex. | ||
54 | */ | ||
55 | static inline Eina_Bool | ||
56 | eina_lock_new(Eina_Lock *mutex EINA_UNUSED) | ||
57 | { | ||
58 | return EINA_TRUE; | ||
59 | } | ||
60 | |||
61 | /** | ||
62 | * @brief Free the ressources of the given lock object. | ||
63 | * | ||
64 | * @param mutex The lock object to free. | ||
65 | * | ||
66 | * This function frees the resources of @p mutex allocated by | ||
67 | * eina_lock_new(). For performance reasons, no check is done on | ||
68 | * @p mutex. | ||
69 | */ | ||
70 | static inline void | ||
71 | eina_lock_free(Eina_Lock *mutex EINA_UNUSED) | ||
72 | { | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * @brief Lock the given mutual exclusion object. | ||
77 | * | ||
78 | * @param mutex The lock object to lock. | ||
79 | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | ||
80 | * | ||
81 | * This function locks @p mutex. @p mutex must have been created by | ||
82 | * eina_lock_new(). On success, this function returns #EINA_TRUE | ||
83 | * and #EINA_FALSE otherwise. For performance reasons, no check is done on | ||
84 | * @p mutex. | ||
85 | */ | ||
86 | static inline Eina_Lock_Result | ||
87 | eina_lock_take(Eina_Lock *mutex EINA_UNUSED) | ||
88 | { | ||
89 | return EINA_LOCK_SUCCEED; | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * @brief Try to lock the given mutual exclusion object. | ||
94 | * | ||
95 | * @param mutex The lock object to try to lock. | ||
96 | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | ||
97 | * | ||
98 | * This function tries to lock @p mutex. @p mutex must have been created by | ||
99 | * eina_lock_new(). If @p mutex can be locked, this function returns #EINA_TRUE; | ||
100 | * if @p mutex can not be locked, or is already locked, it | ||
101 | * returns #EINA_FALSE. This function does not block and returns | ||
102 | * immediately. For performance reasons, no check is done on | ||
103 | * @p mutex. | ||
104 | * | ||
105 | * @note On Windows CE, this function is actually eina_lock_take(). | ||
106 | */ | ||
107 | static inline Eina_Lock_Result | ||
108 | eina_lock_take_try(Eina_Lock *mutex EINA_UNUSED) | ||
109 | { | ||
110 | return EINA_LOCK_SUCCEED; | ||
111 | } | ||
112 | |||
113 | /** | ||
114 | * @brief Unlock the given mutual exclusion object. | ||
115 | * | ||
116 | * @param mutex The lock object to unlock. | ||
117 | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | ||
118 | * | ||
119 | * This function unlocks @p mutex. @p mutex must have been created by | ||
120 | * eina_lock_new(). On success, this function returns #EINA_TRUE | ||
121 | * and #EINA_FALSE otherwise. For performance reasons, no check is | ||
122 | * done on @p mutex. | ||
123 | */ | ||
124 | static inline Eina_Lock_Result | ||
125 | eina_lock_release(Eina_Lock *mutex EINA_UNUSED) | ||
126 | { | ||
127 | return EINA_LOCK_SUCCEED; | ||
128 | } | ||
129 | |||
130 | static inline void | ||
131 | eina_lock_debug(const Eina_Lock *mutex EINA_UNUSED) | ||
132 | { | ||
133 | } | ||
134 | |||
135 | static inline Eina_Bool | ||
136 | eina_condition_new(Eina_Condition *cond EINA_UNUSED, Eina_Lock *mutex EINA_UNUSED) | ||
137 | { | ||
138 | return EINA_TRUE; | ||
139 | } | ||
140 | |||
141 | static inline void | ||
142 | eina_condition_free(Eina_Condition *cond EINA_UNUSED) | ||
143 | { | ||
144 | } | ||
145 | |||
146 | static inline Eina_Bool | ||
147 | eina_condition_wait(Eina_Condition *cond EINA_UNUSED) | ||
148 | { | ||
149 | return EINA_TRUE; | ||
150 | } | ||
151 | |||
152 | static inline Eina_Bool | ||
153 | eina_condition_timedwait(Eina_Condition *cond EINA_UNUSED, double val EINA_UNUSED) | ||
154 | { | ||
155 | return EINA_TRUE; | ||
156 | } | ||
157 | |||
158 | static inline Eina_Bool | ||
159 | eina_condition_broadcast(Eina_Condition *cond EINA_UNUSED) | ||
160 | { | ||
161 | return EINA_TRUE; | ||
162 | } | ||
163 | |||
164 | static inline Eina_Bool | ||
165 | eina_condition_signal(Eina_Condition *cond EINA_UNUSED) | ||
166 | { | ||
167 | return EINA_TRUE; | ||
168 | } | ||
169 | |||
170 | static inline Eina_Bool | ||
171 | eina_rwlock_new(Eina_RWLock *mutex EINA_UNUSED) | ||
172 | { | ||
173 | return EINA_TRUE; | ||
174 | } | ||
175 | |||
176 | static inline void | ||
177 | eina_rwlock_free(Eina_RWLock *mutex EINA_UNUSED) | ||
178 | { | ||
179 | } | ||
180 | |||
181 | static inline Eina_Lock_Result | ||
182 | eina_rwlock_read_take(Eina_RWLock *mutex EINA_UNUSED) | ||
183 | { | ||
184 | return EINA_LOCK_SUCCEED; | ||
185 | } | ||
186 | |||
187 | static inline Eina_Lock_Result | ||
188 | eina_rwlock_write_take(Eina_RWLock *mutex EINA_UNUSED) | ||
189 | { | ||
190 | return EINA_LOCK_SUCCEED; | ||
191 | } | ||
192 | |||
193 | static inline Eina_Lock_Result | ||
194 | eina_rwlock_release(Eina_RWLock *mutex EINA_UNUSED) | ||
195 | { | ||
196 | return EINA_LOCK_SUCCEED; | ||
197 | } | ||
198 | |||
199 | static inline Eina_Lock_Result | ||
200 | eina_rwlock_take_read(Eina_RWLock *mutex EINA_UNUSED) | ||
201 | { | ||
202 | return EINA_LOCK_SUCCEED; | ||
203 | } | ||
204 | |||
205 | static inline Eina_Lock_Result | ||
206 | eina_rwlock_take_write(Eina_RWLock *mutex EINA_UNUSED) | ||
207 | { | ||
208 | return EINA_LOCK_SUCCEED; | ||
209 | } | ||
210 | |||
211 | static inline Eina_Bool | ||
212 | eina_tls_new(Eina_TLS *key EINA_UNUSED) | ||
213 | { | ||
214 | return EINA_TRUE; | ||
215 | } | ||
216 | |||
217 | static inline void | ||
218 | eina_tls_free(Eina_TLS key EINA_UNUSED) | ||
219 | { | ||
220 | } | ||
221 | |||
222 | static inline void * | ||
223 | eina_tls_get(Eina_TLS key EINA_UNUSED) | ||
224 | { | ||
225 | return NULL; | ||
226 | } | ||
227 | |||
228 | static inline Eina_Bool | ||
229 | eina_tls_set(Eina_TLS key EINA_UNUSED, const void *data EINA_UNUSED) | ||
230 | { | ||
231 | return EINA_TRUE; | ||
232 | } | ||
233 | |||
234 | static inline Eina_Bool | ||
235 | eina_semaphore_new(Eina_Semaphore *sem EINA_UNUSED, | ||
236 | int count_init EINA_UNUSED) | ||
237 | { | ||
238 | return EINA_TRUE; | ||
239 | } | ||
240 | |||
241 | static inline Eina_Bool | ||
242 | eina_semaphore_free(Eina_Semaphore *sem EINA_UNUSED) | ||
243 | { | ||
244 | return EINA_TRUE; | ||
245 | } | ||
246 | |||
247 | static inline Eina_Bool | ||
248 | eina_semaphore_lock(Eina_Semaphore *sem EINA_UNUSED) | ||
249 | { | ||
250 | return EINA_TRUE; | ||
251 | } | ||
252 | |||
253 | static inline Eina_Bool | ||
254 | eina_semaphore_release(Eina_Semaphore *sem EINA_UNUSED, | ||
255 | int count_release EINA_UNUSED) | ||
256 | { | ||
257 | return EINA_TRUE; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * @} | ||
262 | */ | ||
263 | |||
264 | #endif | ||
diff --git a/src/lib/eina/eina_lock.h b/src/lib/eina/eina_lock.h index f438586a54..5260ed9c4b 100644 --- a/src/lib/eina/eina_lock.h +++ b/src/lib/eina/eina_lock.h | |||
@@ -42,16 +42,12 @@ typedef enum | |||
42 | EINA_LOCK_DEADLOCK | 42 | EINA_LOCK_DEADLOCK |
43 | } Eina_Lock_Result; | 43 | } Eina_Lock_Result; |
44 | 44 | ||
45 | #ifdef EINA_HAVE_THREADS | 45 | #ifdef _WIN32_WCE |
46 | # ifdef _WIN32_WCE | 46 | # include "eina_inline_lock_wince.x" |
47 | # include "eina_inline_lock_wince.x" | 47 | #elif defined(_WIN32) |
48 | # elif defined(_WIN32) | 48 | # include "eina_inline_lock_win32.x" |
49 | # include "eina_inline_lock_win32.x" | ||
50 | # else | ||
51 | # include "eina_inline_lock_posix.x" | ||
52 | # endif | ||
53 | #else | 49 | #else |
54 | # include "eina_inline_lock_void.x" | 50 | # include "eina_inline_lock_posix.x" |
55 | #endif | 51 | #endif |
56 | 52 | ||
57 | EAPI extern Eina_Error EINA_ERROR_NOT_MAIN_LOOP; | 53 | EAPI extern Eina_Error EINA_ERROR_NOT_MAIN_LOOP; |