efl: unify EFL_DEBUG_THREADS and EINA_HAVE_DEBUG_THREADS

SVN revision: 77821
This commit is contained in:
Gustavo Sverzut Barbieri 2012-10-10 21:48:34 +00:00
parent 6589b75b98
commit c432e72582
3 changed files with 14 additions and 13 deletions

View File

@ -516,7 +516,6 @@ EFL_CHECK_THREADS
if test "$want_debug_threads" = "yes"; then if test "$want_debug_threads" = "yes"; then
EINA_CONFIGURE_HAVE_DEBUG_THREADS="#define EINA_HAVE_DEBUG_THREADS" EINA_CONFIGURE_HAVE_DEBUG_THREADS="#define EINA_HAVE_DEBUG_THREADS"
AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
fi fi
AC_SUBST(EINA_CONFIGURE_HAVE_DEBUG_THREADS) AC_SUBST(EINA_CONFIGURE_HAVE_DEBUG_THREADS)

View File

@ -26,7 +26,7 @@
#ifdef EFL_HAVE_POSIX_THREADS #ifdef EFL_HAVE_POSIX_THREADS
#include <pthread.h> #include <pthread.h>
# ifdef EFL_DEBUG_THREADS # ifdef EINA_HAVE_DEBUG_THREADS
# include <assert.h> # include <assert.h>
# endif # endif
#endif #endif
@ -41,6 +41,7 @@
# undef WIN32_LEAN_AND_MEAN # undef WIN32_LEAN_AND_MEAN
#endif #endif
#include "eina_config.h"
#include "eina_inlist.h" #include "eina_inlist.h"
#include "eina_error.h" #include "eina_error.h"
#include "eina_module.h" #include "eina_module.h"
@ -81,7 +82,7 @@ struct _Chained_Mempool
#ifdef EINA_DEBUG_MALLOC #ifdef EINA_DEBUG_MALLOC
int minimal_size; int minimal_size;
#endif #endif
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
pthread_t self; pthread_t self;
#endif #endif
Eina_Lock mutex; Eina_Lock mutex;
@ -264,7 +265,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
if (!eina_lock_take(&pool->mutex)) if (!eina_lock_take(&pool->mutex))
{ {
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(pool->self, pthread_self())); assert(pthread_equal(pool->self, pthread_self()));
#endif #endif
} }
@ -314,7 +315,7 @@ eina_chained_mempool_free(void *data, void *ptr)
// look 4 pool // look 4 pool
if (!eina_lock_take(&pool->mutex)) if (!eina_lock_take(&pool->mutex))
{ {
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(pool->self, pthread_self())); assert(pthread_equal(pool->self, pthread_self()));
#endif #endif
} }
@ -359,7 +360,7 @@ eina_chained_mempool_repack(void *data,
/* FIXME: Improvement - per Chained_Pool lock */ /* FIXME: Improvement - per Chained_Pool lock */
if (!eina_lock_take(&pool->mutex)) if (!eina_lock_take(&pool->mutex))
{ {
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(pool->self, pthread_self())); assert(pthread_equal(pool->self, pthread_self()));
#endif #endif
} }
@ -477,7 +478,7 @@ eina_chained_mempool_init(const char *context,
VALGRIND_CREATE_MEMPOOL(mp, 0, 1); VALGRIND_CREATE_MEMPOOL(mp, 0, 1);
#endif #endif
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
mp->self = pthread_self(); mp->self = pthread_self();
#endif #endif
@ -521,7 +522,7 @@ eina_chained_mempool_shutdown(void *data)
eina_lock_free(&mp->mutex); eina_lock_free(&mp->mutex);
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(mp->self, pthread_self())); assert(pthread_equal(mp->self, pthread_self()));
#endif #endif

View File

@ -35,6 +35,7 @@
# undef WIN32_LEAN_AND_MEAN # undef WIN32_LEAN_AND_MEAN
#endif #endif
#include "eina_config.h"
#include "eina_mempool.h" #include "eina_mempool.h"
#include "eina_trash.h" #include "eina_trash.h"
#include "eina_inlist.h" #include "eina_inlist.h"
@ -76,7 +77,7 @@ struct _One_Big
Eina_Trash *empty; Eina_Trash *empty;
Eina_Inlist *over_list; Eina_Inlist *over_list;
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
pthread_t self; pthread_t self;
#endif #endif
Eina_Lock mutex; Eina_Lock mutex;
@ -90,7 +91,7 @@ eina_one_big_malloc(void *data, EINA_UNUSED unsigned int size)
if (!eina_lock_take(&pool->mutex)) if (!eina_lock_take(&pool->mutex))
{ {
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(pool->self, pthread_self())); assert(pthread_equal(pool->self, pthread_self()));
#endif #endif
} }
@ -158,7 +159,7 @@ eina_one_big_free(void *data, void *ptr)
if (!eina_lock_take(&pool->mutex)) if (!eina_lock_take(&pool->mutex))
{ {
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(pool->self, pthread_self())); assert(pthread_equal(pool->self, pthread_self()));
#endif #endif
} }
@ -231,7 +232,7 @@ eina_one_big_init(const char *context,
memcpy((char *)pool->name, context, length); memcpy((char *)pool->name, context, length);
} }
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
pool->self = pthread_self(); pool->self = pthread_self();
#endif #endif
eina_lock_new(&pool->mutex); eina_lock_new(&pool->mutex);
@ -251,7 +252,7 @@ eina_one_big_shutdown(void *data)
if (!pool) return; if (!pool) return;
if (!eina_lock_take(&pool->mutex)) if (!eina_lock_take(&pool->mutex))
{ {
#ifdef EFL_DEBUG_THREADS #ifdef EINA_HAVE_DEBUG_THREADS
assert(pthread_equal(pool->self, pthread_self())); assert(pthread_equal(pool->self, pthread_self()));
#endif #endif
} }