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 :)
This commit is contained in:
Jean Guyomarc'h 2016-11-15 19:59:54 +01:00
parent 60bb5621d1
commit a1e1bb01ba
No known key found for this signature in database
GPG Key ID: 9BFD70B4662DC58C
2 changed files with 15 additions and 13 deletions

View 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

View 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);
/**
* @}