From: Cedric Bail Date: Thu, 10 Oct 2013 08:31:54 +0000 (+0900) Subject: eina: use Eina_Spinlock for Eina_Chained_Mempool. X-Git-Tag: submit/devel/efl/20131029.075644~103 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12d34309c7c6e3f3041ee576afe93f9ca335059e;p=platform%2Fupstream%2Fefl.git eina: use Eina_Spinlock for Eina_Chained_Mempool. --- diff --git a/ChangeLog b/ChangeLog index 892a7a8..9113fc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2013-10-11 Cedric Bail * Eina: add Eina_Spinlock API, - use Eina_Spinlock in Eina_Log, replace Eina_Lock by Eina_Spinlock in Eina_Stringshare. + use Eina_Spinlock in Eina_Log, replace Eina_Lock by Eina_Spinlock in Eina_Stringshare, + Eina_Chained_Mempool. * Eet: replace Eina_Lock by Eina_Spinlock in Eet_Dictionnary. 2013-10-10 Carsten Haitzler (The Rasterman) diff --git a/NEWS b/NEWS index 00c4dbd..64bb665 100644 --- a/NEWS +++ b/NEWS @@ -198,7 +198,7 @@ Improvements: - Eina_Tiler now take tile size into account. - Improve support for 64bits system. - eina_strlcat now work with a NULL source. - - Use Eina_Spinlock for eina_log, eina_stringshare. + - Use Eina_Spinlock for eina_log, eina_stringshare and chained_mempool. * Eet: - Display more information with eet -l -v. - Force thread to always run during eet_cache_concurrency test. diff --git a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c index 830ad67..e3fcb59 100644 --- a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c +++ b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c @@ -84,7 +84,7 @@ struct _Chained_Mempool #ifdef EINA_HAVE_DEBUG_THREADS Eina_Thread self; #endif - Eina_Lock mutex; + Eina_Spinlock mutex; }; typedef struct _Chained_Pool Chained_Pool; @@ -268,7 +268,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size) Chained_Pool *p = NULL; void *mem; - if (!eina_lock_take(&pool->mutex)) + if (!eina_spinlock_take(&pool->mutex)) { #ifdef EINA_HAVE_DEBUG_THREADS assert(eina_thread_equal(pool->self, eina_thread_self())); @@ -294,7 +294,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size) p = _eina_chained_mp_pool_new(pool); if (!p) { - eina_lock_release(&pool->mutex); + eina_spinlock_release(&pool->mutex); return NULL; } @@ -305,7 +305,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size) mem = _eina_chained_mempool_alloc_in(pool, p); - eina_lock_release(&pool->mutex); + eina_spinlock_release(&pool->mutex); return mem; } @@ -318,7 +318,7 @@ eina_chained_mempool_free(void *data, void *ptr) Chained_Pool *p; // look 4 pool - if (!eina_lock_take(&pool->mutex)) + if (!eina_spinlock_take(&pool->mutex)) { #ifdef EINA_HAVE_DEBUG_THREADS assert(eina_thread_equal(pool->self, eina_thread_self())); @@ -349,7 +349,7 @@ eina_chained_mempool_free(void *data, void *ptr) } #endif - eina_lock_release(&pool->mutex); + eina_spinlock_release(&pool->mutex); return; } @@ -363,7 +363,7 @@ eina_chained_mempool_repack(void *data, Chained_Pool *tail; /* FIXME: Improvement - per Chained_Pool lock */ - if (!eina_lock_take(&pool->mutex)) + if (!eina_spinlock_take(&pool->mutex)) { #ifdef EINA_HAVE_DEBUG_THREADS assert(eina_thread_equal(pool->self, eina_thread_self())); @@ -436,7 +436,7 @@ eina_chained_mempool_repack(void *data, } /* FIXME: improvement - reorder pool so that the most used one get in front */ - eina_lock_release(&pool->mutex); + eina_spinlock_release(&pool->mutex); } static void * @@ -492,7 +492,7 @@ eina_chained_mempool_init(const char *context, mp->self = eina_thread_self(); #endif - eina_lock_new(&mp->mutex); + eina_spinlock_new(&mp->mutex); return mp; } @@ -530,7 +530,7 @@ eina_chained_mempool_shutdown(void *data) VALGRIND_DESTROY_MEMPOOL(mp); #endif - eina_lock_free(&mp->mutex); + eina_spinlock_free(&mp->mutex); #ifdef EINA_HAVE_DEBUG_THREADS assert(eina_thread_equal(mp->self, eina_thread_self()));