summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2020-05-04 23:51:21 -0300
committerFelipe Magno de Almeida <felipe@expertise.dev>2020-05-04 23:51:21 -0300
commit17f5baf49887a386cc35485291c45637662bbd45 (patch)
tree9eae8b4472cd027392462a650cc516feb54e176f
parente84115e1355b3a26d9f7907cbcdc26efafccb303 (diff)
windows: Do not use thread_push and thread_pop
-rw-r--r--src/lib/eina/eina_inline_thread_posix.x65
-rw-r--r--src/lib/eina/eina_inline_thread_win32.x5
-rw-r--r--src/lib/eina/eina_thread.h62
3 files changed, 68 insertions, 64 deletions
diff --git a/src/lib/eina/eina_inline_thread_posix.x b/src/lib/eina/eina_inline_thread_posix.x
index 9bb5698de8..d9ca3111a7 100644
--- a/src/lib/eina/eina_inline_thread_posix.x
+++ b/src/lib/eina/eina_inline_thread_posix.x
@@ -18,6 +18,69 @@
18 18
19#include "eina_thread_posix.h" 19#include "eina_thread_posix.h"
20 20
21/**
22 * @def EINA_THREAD_CLEANUP_PUSH(cleanup, data)
23 *
24 * @brief Pushes a cleanup function to be executed when the thread is
25 * canceled.
26 *
27 * This macro will schedule a function cleanup(data) to be executed if
28 * the thread is canceled with eina_thread_cancel() and the thread
29 * was previously marked as cancellable with
30 * eina_thread_cancellable_set().
31 *
32 * It @b must be paired with EINA_THREAD_CLEANUP_POP() in the same
33 * code block as they will expand to do {} while ()!
34 *
35 * The cleanup function may also be executed if
36 * EINA_THREAD_CLEANUP_POP(EINA_TRUE) is used.
37 *
38 * @note If the block within EINA_THREAD_CLEANUP_PUSH() and
39 * EINA_THREAD_CLEANUP_POP() returns, the cleanup callback will
40 * @b not be executed! To avoid problems prefer to use
41 * eina_thread_cancellable_run()!
42 *
43 * @param[in] cleanup The function to execute on cancellation.
44 * @param[in] data The context to give to cleanup function.
45 *
46 * @see eina_thread_cancellable_run()
47 *
48 * @since 1.19
49 */
50#define EINA_THREAD_CLEANUP_PUSH(cleanup, data) \
51 pthread_cleanup_push(cleanup, data)
52
53/**
54 * @def EINA_THREAD_CLEANUP_POP(exec_cleanup)
55 *
56 * @brief Pops a cleanup function to be executed when the thread is
57 * canceled.
58 *
59 * This macro will remove a previously pushed cleanup function, thus
60 * if the thread is canceled with eina_thread_cancel() and the thread
61 * was previously marked as cancellable with
62 * eina_thread_cancellable_set(), that cleanup won't be executed
63 * anymore.
64 *
65 * It @b must be paired with EINA_THREAD_CLEANUP_PUSH() in the same
66 * code block as they will expand to do {} while ()!
67 *
68 * @note If the block within EINA_THREAD_CLEANUP_PUSH() and
69 * EINA_THREAD_CLEANUP_POP() returns, the cleanup callback will
70 * @b not be executed even if exec_cleanup is EINA_TRUE! To
71 * avoid problems prefer to use eina_thread_cancellable_run()!
72 *
73 * @param[in] exec_cleanup if EINA_TRUE, the function registered with
74 * EINA_THREAD_CLEANUP_PUSH() will be executed.
75 *
76 * @see eina_thread_cancellable_run()
77 *
78 * @since 1.19
79 */
80#define EINA_THREAD_CLEANUP_POP(exec_cleanup) \
81 pthread_cleanup_pop(exec_cleanup)
82
83
21static inline void * 84static inline void *
22_eina_thread_join(Eina_Thread t) 85_eina_thread_join(Eina_Thread t)
23{ 86{
@@ -136,4 +199,4 @@ _eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
136static inline void 199static inline void
137_eina_thread_cancel_checkpoint(){ 200_eina_thread_cancel_checkpoint(){
138 pthread_testcancel(); 201 pthread_testcancel();
139} \ No newline at end of file 202}
diff --git a/src/lib/eina/eina_inline_thread_win32.x b/src/lib/eina/eina_inline_thread_win32.x
index 60ef9d1f80..60100e1d61 100644
--- a/src/lib/eina/eina_inline_thread_win32.x
+++ b/src/lib/eina/eina_inline_thread_win32.x
@@ -20,6 +20,9 @@
20 20
21#include "eina_thread_win32.h" 21#include "eina_thread_win32.h"
22 22
23#define EINA_THREAD_CLEANUP_PUSH(cleanup, data)
24#define EINA_THREAD_CLEANUP_POP(exec_cleanup)
25
23typedef struct _Eina_Win32_Thread_Func 26typedef struct _Eina_Win32_Thread_Func
24{ 27{
25 void *data; 28 void *data;
@@ -182,4 +185,4 @@ EINA_THREAD_CANCEL_DISABLE;
182 return EINA_TRUE; 185 return EINA_TRUE;
183 } 186 }
184} 187}
185#endif \ No newline at end of file 188#endif
diff --git a/src/lib/eina/eina_thread.h b/src/lib/eina/eina_thread.h
index c0c0539932..bbb2e1a5b2 100644
--- a/src/lib/eina/eina_thread.h
+++ b/src/lib/eina/eina_thread.h
@@ -228,68 +228,6 @@ EINA_API Eina_Bool eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool
228EINA_API void eina_thread_cancel_checkpoint(void); 228EINA_API void eina_thread_cancel_checkpoint(void);
229 229
230/** 230/**
231 * @def EINA_THREAD_CLEANUP_PUSH(cleanup, data)
232 *
233 * @brief Pushes a cleanup function to be executed when the thread is
234 * canceled.
235 *
236 * This macro will schedule a function cleanup(data) to be executed if
237 * the thread is canceled with eina_thread_cancel() and the thread
238 * was previously marked as cancellable with
239 * eina_thread_cancellable_set().
240 *
241 * It @b must be paired with EINA_THREAD_CLEANUP_POP() in the same
242 * code block as they will expand to do {} while ()!
243 *
244 * The cleanup function may also be executed if
245 * EINA_THREAD_CLEANUP_POP(EINA_TRUE) is used.
246 *
247 * @note If the block within EINA_THREAD_CLEANUP_PUSH() and
248 * EINA_THREAD_CLEANUP_POP() returns, the cleanup callback will
249 * @b not be executed! To avoid problems prefer to use
250 * eina_thread_cancellable_run()!
251 *
252 * @param[in] cleanup The function to execute on cancellation.
253 * @param[in] data The context to give to cleanup function.
254 *
255 * @see eina_thread_cancellable_run()
256 *
257 * @since 1.19
258 */
259#define EINA_THREAD_CLEANUP_PUSH(cleanup, data) \
260 pthread_cleanup_push(cleanup, data)
261
262/**
263 * @def EINA_THREAD_CLEANUP_POP(exec_cleanup)
264 *
265 * @brief Pops a cleanup function to be executed when the thread is
266 * canceled.
267 *
268 * This macro will remove a previously pushed cleanup function, thus
269 * if the thread is canceled with eina_thread_cancel() and the thread
270 * was previously marked as cancellable with
271 * eina_thread_cancellable_set(), that cleanup won't be executed
272 * anymore.
273 *
274 * It @b must be paired with EINA_THREAD_CLEANUP_PUSH() in the same
275 * code block as they will expand to do {} while ()!
276 *
277 * @note If the block within EINA_THREAD_CLEANUP_PUSH() and
278 * EINA_THREAD_CLEANUP_POP() returns, the cleanup callback will
279 * @b not be executed even if exec_cleanup is EINA_TRUE! To
280 * avoid problems prefer to use eina_thread_cancellable_run()!
281 *
282 * @param[in] exec_cleanup if EINA_TRUE, the function registered with
283 * EINA_THREAD_CLEANUP_PUSH() will be executed.
284 *
285 * @see eina_thread_cancellable_run()
286 *
287 * @since 1.19
288 */
289#define EINA_THREAD_CLEANUP_POP(exec_cleanup) \
290 pthread_cleanup_pop(exec_cleanup)
291
292/**
293 * @typedef Eina_Thread_Cancellable_Run_Cb 231 * @typedef Eina_Thread_Cancellable_Run_Cb
294 * Type for the definition of a cancellable callback to run. 232 * Type for the definition of a cancellable callback to run.
295 * 233 *