you did that in such a way that the compilation on Windows is broken if
one choose that configure option
Vincent
On Wed, 13 Oct 2010, Enlightenment SVN wrote:
> Log:
> * eina: add assert to ease tracking down efl misuse with threads.
>
> Author: cedric
> Date: 2010-10-13 08:35:56 -0700 (Wed, 13 Oct 2010)
> New Revision: 53360
>
> Modified:
> trunk/eina/configure.ac trunk/eina/m4/efl_threads.m4
> trunk/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
>
> Modified: trunk/eina/configure.ac
> ===================================================================
> --- trunk/eina/configure.ac 2010-10-13 15:22:13 UTC (rev 53359)
> +++ trunk/eina/configure.ac 2010-10-13 15:35:56 UTC (rev 53360)
> @@ -593,6 +593,7 @@
> echo " Thread Support.......: ${have_threads}"
> if test "${have_threads}" = "POSIX" ; then
> echo " spinlock...........: ${have_posix_threads_spinlock}"
> +echo " debug usage........: ${have_debug_threads}"
> fi
> echo " Amalgamation.........: ${do_amalgamation}"
> echo " Iconv support........: ${have_iconv}"
>
> Modified: trunk/eina/m4/efl_threads.m4
> ===================================================================
> --- trunk/eina/m4/efl_threads.m4 2010-10-13 15:22:13 UTC (rev 53359)
> +++ trunk/eina/m4/efl_threads.m4 2010-10-13 15:35:56 UTC (rev 53360)
> @@ -134,11 +134,21 @@
> AC_SUBST(EFL_PTHREAD_CFLAGS)
> AC_SUBST(EFL_PTHREAD_LIBS)
>
> +_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])],
> + [_efl_enable_debug_threads="${enableval}"])
> +
> +have_debug_threads="no"
> +if test "x${_efl_have_posix_threads}" = "xyes" -a
> "x${_efl_enable_debug_threads}" = "xyes"; then
> + have_debug_threads="yes"
> + AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call
> eina_threads_init])
> +fi
> +
> if test "x${_efl_have_posix_threads}" = "xyes" ; then
> AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX
> threads are supported])
> fi
>
> -
> if test "x${_efl_enable_win32_threads}" = "xyes" ; then
> _efl_have_win32_threads="yes"
> AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32
> threads are supported])
>
> Modified: trunk/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
> ===================================================================
> --- trunk/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
> 2010-10-13 15:22:13 UTC (rev 53359)
> +++ trunk/eina/src/modules/mp/chained_pool/eina_chained_mempool.c
> 2010-10-13 15:35:56 UTC (rev 53360)
> @@ -52,6 +52,10 @@
> #define INF(...) EINA_LOG_DOM_INFO(_eina_mempool_log_dom, __VA_ARGS__)
> #endif
>
> +#ifdef EFL_DEBUG_THREADS
> +#include <assert.h>
> +#endif
> +
> typedef struct _Chained_Mempool Chained_Mempool;
> struct _Chained_Mempool
> {
> @@ -63,6 +67,9 @@
> int group_size;
> int usage;
> #ifdef EFL_HAVE_THREADS
> +#ifdef EFL_DEBUG_THREADS
> + pthread_t self;
> +#endif
> # ifdef EFL_HAVE_POSIX_THREADS
> pthread_mutex_t mutex;
> # else
> @@ -127,7 +134,11 @@
> WaitForSingleObject(pool->mutex, INFINITE);
> # endif
> }
> +#ifdef EFL_DEBUG_THREADS
> + else
> + assert(pool->self == pthread_self());
> #endif
> +#endif
>
> // look 4 pool from 2nd bucket on
> EINA_INLIST_FOREACH(pool->first, p)
> @@ -214,12 +225,16 @@
> WaitForSingleObject(pool->mutex, INFINITE);
> # endif
> }
> +#ifdef EFL_DEBUG_THREADS
> + else
> + assert(pool->self == pthread_self());
> #endif
> +#endif
>
> EINA_INLIST_FOREACH(pool->first, p)
> {
> // Could the pointer be inside that pool
> - if (ptr < p->limit)
> + if ((unsigned char*) ptr < p->limit)
> {
> // pool mem base
> pmem = (void *)(((unsigned char *)p) + sizeof(Chained_Pool));
> @@ -293,6 +308,9 @@
> mp->item_alloc = eina_mempool_alignof(item_size);
> mp->group_size = mp->item_alloc * mp->pool_size;
> mp->alloc_size = mp->group_size +
> eina_mempool_alignof(sizeof(Chained_Pool));
> +#ifdef EFL_DEBUG_THREADS
> + mp->self = pthread_self();
> +#endif
>
> #ifdef EFL_HAVE_THREADS
> # ifdef EFL_HAVE_POSIX_THREADS
> @@ -328,6 +346,9 @@
> }
>
> #ifdef EFL_HAVE_THREADS
> +#ifdef EFL_DEBUG_THREADS
> + assert(mp->self == pthread_self());
> +#endif
> # ifdef EFL_HAVE_POSIX_THREADS
> pthread_mutex_destroy(&mp->mutex);
> # else
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel