diff --git a/legacy/eina/configure.ac b/legacy/eina/configure.ac index 7ffaa24a62..2886ec647e 100644 --- a/legacy/eina/configure.ac +++ b/legacy/eina/configure.ac @@ -122,6 +122,12 @@ fi AC_SUBST(EINA_CONFIGURE_HAVE_DEBUG_THREADS) AM_CONDITIONAL([EINA_DEBUG_THREADS], [! test "x${have_debug_threads}" = "xno"]) +if ! test "x${have_on_off_threads}" = "xno"; then + EINA_CONFIGURE_HAVE_ON_OFF_THREADS="#define EINA_ON_OFF_THREADS" +fi +AC_SUBST(EINA_CONFIGURE_HAVE_ON_OFF_THREADS) +AM_CONDITIONAL([EINA_ON_OFF_THREADS], [! test "x${have_on_off_threads}" = "xno"]) + ### Additional options to configure # Magic debug @@ -675,6 +681,7 @@ echo " Thread Support.......: ${have_threads}" if test "${have_threads}" = "POSIX" ; then echo " spinlock...........: ${have_posix_threads_spinlock}" echo " debug usage........: ${have_debug_threads}" +echo " on/off support.....: ${have_on_off_threads}" fi echo " Amalgamation.........: ${do_amalgamation}" echo " Iconv support........: ${have_iconv}" diff --git a/legacy/eina/m4/efl_threads.m4 b/legacy/eina/m4/efl_threads.m4 index 33d15a39b4..a761d51197 100644 --- a/legacy/eina/m4/efl_threads.m4 +++ b/legacy/eina/m4/efl_threads.m4 @@ -134,6 +134,19 @@ fi AC_SUBST(EFL_PTHREAD_CFLAGS) AC_SUBST(EFL_PTHREAD_LIBS) +_efl_enable_on_off_threads="no" +AC_ARG_ENABLE([on-off-threads], + [AC_HELP_STRING([--enable-on-off-threads], [only turn this on if you know what you are doing, and don't complain if the world freeze])], + [_efl_enable_on_off_threads="${enableval}"]) + +have_on_off_threads="no" +if test "x${_efl_enable_on_off_threads}" = "xyes"; then + have_on_off_threads="yes" + AC_DEFINE([EFL_ON_OFF_THREADS], [1], [make it possible to disable all locks]) +fi +AC_MSG_CHECKING([whether to turn on/off threads lock on demand]) +AC_MSG_RESULT([${_efl_enable_on_off_threads}]) + _efl_enable_debug_threads="no" AC_ARG_ENABLE([debug-threads], [AC_HELP_STRING([--enable-debug-threads], [disable assert when you forgot to call eina_threads_init])], diff --git a/legacy/eina/m4/efl_voltron.m4 b/legacy/eina/m4/efl_voltron.m4 index c710466af8..43b334e6e9 100644 --- a/legacy/eina/m4/efl_voltron.m4 +++ b/legacy/eina/m4/efl_voltron.m4 @@ -18,7 +18,7 @@ AC_ARG_ENABLE([voltron], [have_voltron="no"] ) - if test "x$have_voltron" = "xyes" -a "x$do_amalgamation" = "xyes";then + if test "x$have_voltron" = "xyes" -a "x$do_amalgamation" = "xyes" -o "x${have_on_off_threads}" = "xyes"; then echo "//////////////////////////////////////////////////////////////////////////////////////////////////////////////////" echo "/////////////////////////////////////////////////////////////////////////////////////{#///////////////////////////" echo "/////////////////////////////////////////////////////////////////////////////////// EN3 xx&HWx////////////////////" diff --git a/legacy/eina/src/include/eina_config.h.in b/legacy/eina/src/include/eina_config.h.in index cf7af51ee6..be328cd651 100644 --- a/legacy/eina/src/include/eina_config.h.in +++ b/legacy/eina/src/include/eina_config.h.in @@ -59,4 +59,9 @@ #endif #define EINA_SIZEOF_WCHAR_T @EINA_SIZEOF_WCHAR_T@ +#ifdef EINA_HAVE_ON_OFF_THREADS +# undef EINA_HAVE_ON_OFF_THREADS +#endif +@EINA_CONFIGURE_HAVE_ON_OFF_THREADS@ + #endif /* EINA_CONFIG_H_ */ diff --git a/legacy/eina/src/include/eina_inline_lock_posix.x b/legacy/eina/src/include/eina_inline_lock_posix.x index 3f6c8d3c0f..d7c1a138b7 100644 --- a/legacy/eina/src/include/eina_inline_lock_posix.x +++ b/legacy/eina/src/include/eina_inline_lock_posix.x @@ -102,13 +102,20 @@ eina_lock_free(Eina_Lock *mutex) static inline Eina_Lock_Result eina_lock_take(Eina_Lock *mutex) { - Eina_Bool ret = EINA_FALSE; + Eina_Lock_Result ret = EINA_FALSE; int ok; +#ifdef EINA_HAVE_ON_OFF_THREADS + if (!_eina_threads_activated) + { #ifdef EINA_HAVE_DEBUG_THREADS - if (_eina_threads_activated) - assert(pthread_equal(_eina_main_loop, pthread_self())); + assert(pthread_equal(_eina_main_loop, pthread_self())); +#endif + return EINA_FALSE; + } +#endif +#ifdef EINA_HAVE_DEBUG_THREADS if (_eina_threads_debug) { struct timeval t0, t1; @@ -146,11 +153,21 @@ eina_lock_take(Eina_Lock *mutex) static inline Eina_Lock_Result eina_lock_take_try(Eina_Lock *mutex) { - Eina_Bool ret = EINA_FALSE; + Eina_Lock_Result ret = EINA_FALSE; int ok; +#ifdef EINA_HAVE_ON_OFF_THREADS + if (!_eina_threads_activated) + { #ifdef EINA_HAVE_DEBUG_THREADS - if (_eina_threads_activated) + assert(pthread_equal(_eina_main_loop, pthread_self())); +#endif + return EINA_FALSE; + } +#endif + +#ifdef EINA_HAVE_DEBUG_THREADS + if (!_eina_threads_activated) assert(pthread_equal(_eina_main_loop, pthread_self())); #endif @@ -175,11 +192,16 @@ eina_lock_take_try(Eina_Lock *mutex) static inline Eina_Lock_Result eina_lock_release(Eina_Lock *mutex) { - Eina_Bool ret; + Eina_Lock_Result ret; +#ifdef EINA_HAVE_ON_OFF_THREADS + if (!_eina_threads_activated) + { #ifdef EINA_HAVE_DEBUG_THREADS - if (_eina_threads_activated) - assert(pthread_equal(_eina_main_loop, pthread_self())); + assert(pthread_equal(_eina_main_loop, pthread_self())); +#endif + return EINA_FALSE; + } #endif #ifdef EINA_HAVE_DEBUG_THREADS