summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-10-10 20:24:45 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-10-10 20:24:45 +0000
commita6acf1b2d0f219676366cba73bfff9da4bba04fd (patch)
treee9900cfd630c7ae443165b35e007a8e08f60e882
parenta3d116ab37d8c0e611ae799c21b75965ea8c0416 (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
-rw-r--r--configure.ac5
-rw-r--r--m4/efl_threads.m45
-rw-r--r--src/lib/eina/Makefile.am4
-rw-r--r--src/lib/eina/eina_inline_lock_void.x264
-rw-r--r--src/lib/eina/eina_lock.h14
5 files changed, 10 insertions, 282 deletions
diff --git a/configure.ac b/configure.ac
index f3130f8a48..4168b02bee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -536,11 +536,8 @@ AC_SUBST([EINA_CONFIGURE_ENABLE_LOG])
536 536
537EFL_CHECK_THREADS 537EFL_CHECK_THREADS
538 538
539if ! test "x${efl_have_threads}" = "xno" ; then 539EINA_CONFIGURE_HAVE_THREADS="#define EINA_HAVE_THREADS"
540 EINA_CONFIGURE_HAVE_THREADS="#define EINA_HAVE_THREADS"
541fi
542AC_SUBST(EINA_CONFIGURE_HAVE_THREADS) 540AC_SUBST(EINA_CONFIGURE_HAVE_THREADS)
543AM_CONDITIONAL([EINA_HAVE_THREADS], [! test "x${efl_have_threads}" = "xno"])
544 541
545if test "x${efl_have_debug_threads}" = "xyes"; then 542if test "x${efl_have_debug_threads}" = "xyes"; then
546 EINA_CONFIGURE_HAVE_DEBUG_THREADS="#define EINA_HAVE_DEBUG_THREADS" 543 EINA_CONFIGURE_HAVE_DEBUG_THREADS="#define EINA_HAVE_DEBUG_THREADS"
diff --git a/m4/efl_threads.m4 b/m4/efl_threads.m4
index ae296069d8..e3dafa0a06 100644
--- a/m4/efl_threads.m4
+++ b/m4/efl_threads.m4
@@ -145,5 +145,8 @@ if test "x${_efl_have_posix_threads}" = "xyes" && test "x${_efl_enable_debug_thr
145 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init]) 145 AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
146fi 146fi
147 147
148AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2]) 148AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"],
149 [$1],
150 [m4_if([$2], [$2], [AC_MSG_ERROR([Threads are required.])])])
151
149]) 152])
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
90if EINA_HAVE_THREADS
91if HAVE_WINCE 90if HAVE_WINCE
92EINAHEADERS += eina_inline_lock_wince.x 91EINAHEADERS += eina_inline_lock_wince.x
93else 92else
@@ -97,9 +96,6 @@ else
97EINAHEADERS += eina_inline_lock_posix.x 96EINAHEADERS += eina_inline_lock_posix.x
98endif 97endif
99endif 98endif
100else
101EINAHEADERS += eina_inline_lock_void.x
102endif
103 99
104installed_mainheaderdir = $(includedir)/eina-@VMAJ@ 100installed_mainheaderdir = $(includedir)/eina-@VMAJ@
105dist_installed_mainheader_DATA = Eina.h eina_config.h 101dist_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 */
37typedef void *Eina_Lock;
38typedef void *Eina_RWLock;
39typedef void *Eina_Condition;
40typedef void *Eina_TLS;
41typedef 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 */
55static inline Eina_Bool
56eina_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 */
70static inline void
71eina_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 */
86static inline Eina_Lock_Result
87eina_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 */
107static inline Eina_Lock_Result
108eina_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 */
124static inline Eina_Lock_Result
125eina_lock_release(Eina_Lock *mutex EINA_UNUSED)
126{
127 return EINA_LOCK_SUCCEED;
128}
129
130static inline void
131eina_lock_debug(const Eina_Lock *mutex EINA_UNUSED)
132{
133}
134
135static inline Eina_Bool
136eina_condition_new(Eina_Condition *cond EINA_UNUSED, Eina_Lock *mutex EINA_UNUSED)
137{
138 return EINA_TRUE;
139}
140
141static inline void
142eina_condition_free(Eina_Condition *cond EINA_UNUSED)
143{
144}
145
146static inline Eina_Bool
147eina_condition_wait(Eina_Condition *cond EINA_UNUSED)
148{
149 return EINA_TRUE;
150}
151
152static inline Eina_Bool
153eina_condition_timedwait(Eina_Condition *cond EINA_UNUSED, double val EINA_UNUSED)
154{
155 return EINA_TRUE;
156}
157
158static inline Eina_Bool
159eina_condition_broadcast(Eina_Condition *cond EINA_UNUSED)
160{
161 return EINA_TRUE;
162}
163
164static inline Eina_Bool
165eina_condition_signal(Eina_Condition *cond EINA_UNUSED)
166{
167 return EINA_TRUE;
168}
169
170static inline Eina_Bool
171eina_rwlock_new(Eina_RWLock *mutex EINA_UNUSED)
172{
173 return EINA_TRUE;
174}
175
176static inline void
177eina_rwlock_free(Eina_RWLock *mutex EINA_UNUSED)
178{
179}
180
181static inline Eina_Lock_Result
182eina_rwlock_read_take(Eina_RWLock *mutex EINA_UNUSED)
183{
184 return EINA_LOCK_SUCCEED;
185}
186
187static inline Eina_Lock_Result
188eina_rwlock_write_take(Eina_RWLock *mutex EINA_UNUSED)
189{
190 return EINA_LOCK_SUCCEED;
191}
192
193static inline Eina_Lock_Result
194eina_rwlock_release(Eina_RWLock *mutex EINA_UNUSED)
195{
196 return EINA_LOCK_SUCCEED;
197}
198
199static inline Eina_Lock_Result
200eina_rwlock_take_read(Eina_RWLock *mutex EINA_UNUSED)
201{
202 return EINA_LOCK_SUCCEED;
203}
204
205static inline Eina_Lock_Result
206eina_rwlock_take_write(Eina_RWLock *mutex EINA_UNUSED)
207{
208 return EINA_LOCK_SUCCEED;
209}
210
211static inline Eina_Bool
212eina_tls_new(Eina_TLS *key EINA_UNUSED)
213{
214 return EINA_TRUE;
215}
216
217static inline void
218eina_tls_free(Eina_TLS key EINA_UNUSED)
219{
220}
221
222static inline void *
223eina_tls_get(Eina_TLS key EINA_UNUSED)
224{
225 return NULL;
226}
227
228static inline Eina_Bool
229eina_tls_set(Eina_TLS key EINA_UNUSED, const void *data EINA_UNUSED)
230{
231 return EINA_TRUE;
232}
233
234static inline Eina_Bool
235eina_semaphore_new(Eina_Semaphore *sem EINA_UNUSED,
236 int count_init EINA_UNUSED)
237{
238 return EINA_TRUE;
239}
240
241static inline Eina_Bool
242eina_semaphore_free(Eina_Semaphore *sem EINA_UNUSED)
243{
244 return EINA_TRUE;
245}
246
247static inline Eina_Bool
248eina_semaphore_lock(Eina_Semaphore *sem EINA_UNUSED)
249{
250 return EINA_TRUE;
251}
252
253static inline Eina_Bool
254eina_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
57EAPI extern Eina_Error EINA_ERROR_NOT_MAIN_LOOP; 53EAPI extern Eina_Error EINA_ERROR_NOT_MAIN_LOOP;