eina: add back threads on/off support.

NOTE: only use it if you know what you are doing !


SVN revision: 59123
This commit is contained in:
Cedric BAIL 2011-05-02 13:40:28 +00:00
parent 2e0bb38935
commit 691da73b84
5 changed files with 56 additions and 9 deletions

View File

@ -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}"

View File

@ -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])],

View File

@ -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////////////////////"

View File

@ -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_ */

View File

@ -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