diff options
author | Jean Guyomarc'h <jean@guyomarch.bzh> | 2016-11-15 19:59:54 +0100 |
---|---|---|
committer | Jean Guyomarc'h <jean@guyomarch.bzh> | 2016-11-15 22:19:58 +0100 |
commit | a1e1bb01bafffdf5920f6947b4d99b8c5b9c5621 (patch) | |
tree | 7dce67b10bb0f717caf6df3d8307821162f34c7e | |
parent | 60bb5621d12b900767b2e96c2e6cdac71aa616fd (diff) | |
download | efl-a1e1bb01bafffdf5920f6947b4d99b8c5b9c5621.tar.gz |
eina: don't make eina_thread_cancellable_run() inline
Seems to me there is little benefit of inlining this function, but this
also had a pervert effect on Windows and C++ with some recent mingw
versions. Mingw failed its implementation of pthread_cleanup_pop(). It
does not compile when compiled in C++. There is a type mismatch that is
caught by the compiler, and everything goes nuts...
This made the EFL build fail because some files of ecore_win32 are C++
sources, and they require Eina... so this macro appears in a C++ code
indirectly, because of its inlining.
By removing the inlining, this build issue is fixed. Will also fix
builds of other programs that would have used Eina.h in their C++
programs :)
-rw-r--r-- | src/lib/eina/eina_thread.c | 14 | ||||
-rw-r--r-- | src/lib/eina/eina_thread.h | 14 |
2 files changed, 15 insertions, 13 deletions
diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c index f8755044d3..2c681fce25 100644 --- a/src/lib/eina/eina_thread.c +++ b/src/lib/eina/eina_thread.c @@ -257,6 +257,20 @@ eina_thread_cancel_checkpoint(void) pthread_testcancel(); } +EAPI void * +eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data) +{ + Eina_Bool old = EINA_FALSE; + void *ret; + + EINA_THREAD_CLEANUP_PUSH(cleanup_cb, data); + eina_thread_cancellable_set(EINA_TRUE, &old); // is a cancellation point + ret = cb(data); // may not run if was previously canceled + EINA_THREAD_CLEANUP_POP(EINA_TRUE); + eina_thread_cancellable_set(old, NULL); + return ret; +} + EAPI const void *EINA_THREAD_JOIN_CANCELED = PTHREAD_CANCELED; Eina_Bool diff --git a/src/lib/eina/eina_thread.h b/src/lib/eina/eina_thread.h index 07ecec330c..d7a9ad34d6 100644 --- a/src/lib/eina/eina_thread.h +++ b/src/lib/eina/eina_thread.h @@ -336,19 +336,7 @@ typedef void *(*Eina_Thread_Cancellable_Run_Cb)(void *data); * * @since 1.19 */ -static inline void * -eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data) -{ - Eina_Bool old = EINA_FALSE; - void *ret; - - EINA_THREAD_CLEANUP_PUSH(cleanup_cb, data); - eina_thread_cancellable_set(EINA_TRUE, &old); // is a cancellation point - ret = cb(data); // may not run if was previously canceled - EINA_THREAD_CLEANUP_POP(EINA_TRUE); - eina_thread_cancellable_set(old, NULL); - return ret; -} +EAPI void *eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data); /** * @} |