eina: don't make eina_thread_cancellable_run() inline
authorJean Guyomarc'h <jean@guyomarch.bzh>
Tue, 15 Nov 2016 18:59:54 +0000 (19:59 +0100)
committerJean Guyomarc'h <jean@guyomarch.bzh>
Tue, 15 Nov 2016 21:19:58 +0000 (22:19 +0100)
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 :)

src/lib/eina/eina_thread.c
src/lib/eina/eina_thread.h

index f875504..2c681fc 100644 (file)
@@ -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
index 07ecec3..d7a9ad3 100644 (file)
@@ -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);
 
 /**
  * @}