summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--NEWS2
-rw-r--r--src/modules/eina/mp/chained_pool/eina_chained_mempool.c20
3 files changed, 13 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index bc5ce0c02e..ba374ef462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,7 +8,8 @@
82013-10-11 Cedric Bail 82013-10-11 Cedric Bail
9 9
10 * Eina: add Eina_Spinlock API, 10 * Eina: add Eina_Spinlock API,
11 use Eina_Spinlock in Eina_Log, replace Eina_Lock by Eina_Spinlock in Eina_Stringshare. 11 use Eina_Spinlock in Eina_Log, replace Eina_Lock by Eina_Spinlock in Eina_Stringshare,
12 Eina_Chained_Mempool.
12 * Eet: replace Eina_Lock by Eina_Spinlock in Eet_Dictionnary. 13 * Eet: replace Eina_Lock by Eina_Spinlock in Eet_Dictionnary.
13 * Evas: replace Eina_Lock by Eina_Spinlock in Evas_ScaleCache, Evas_Async_Events and Image_Entry. 14 * Evas: replace Eina_Lock by Eina_Spinlock in Evas_ScaleCache, Evas_Async_Events and Image_Entry.
14 * Ecore: use Eina_Spinlock for Ecore_Thread. 15 * Ecore: use Eina_Spinlock for Ecore_Thread.
diff --git a/NEWS b/NEWS
index fa799cbfc3..210b8f55dd 100644
--- a/NEWS
+++ b/NEWS
@@ -200,7 +200,7 @@ Improvements:
200 - Eina_Tiler now take tile size into account. 200 - Eina_Tiler now take tile size into account.
201 - Improve support for 64bits system. 201 - Improve support for 64bits system.
202 - eina_strlcat now work with a NULL source. 202 - eina_strlcat now work with a NULL source.
203 - Use Eina_Spinlock for eina_log, eina_stringshare. 203 - Use Eina_Spinlock for eina_log, eina_stringshare and chained_mempool.
204 * Eet: 204 * Eet:
205 - Display more information with eet -l -v. 205 - Display more information with eet -l -v.
206 - Force thread to always run during eet_cache_concurrency test. 206 - 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 c0257b1f8f..b71b79dcf4 100644
--- a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
+++ b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
@@ -83,7 +83,7 @@ struct _Chained_Mempool
83#ifdef EINA_HAVE_DEBUG_THREADS 83#ifdef EINA_HAVE_DEBUG_THREADS
84 Eina_Thread self; 84 Eina_Thread self;
85#endif 85#endif
86 Eina_Lock mutex; 86 Eina_Spinlock mutex;
87}; 87};
88 88
89typedef struct _Chained_Pool Chained_Pool; 89typedef struct _Chained_Pool Chained_Pool;
@@ -262,7 +262,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
262 Chained_Pool *p = NULL; 262 Chained_Pool *p = NULL;
263 void *mem; 263 void *mem;
264 264
265 if (!eina_lock_take(&pool->mutex)) 265 if (!eina_spinlock_take(&pool->mutex))
266 { 266 {
267#ifdef EINA_HAVE_DEBUG_THREADS 267#ifdef EINA_HAVE_DEBUG_THREADS
268 assert(eina_thread_equal(pool->self, eina_thread_self())); 268 assert(eina_thread_equal(pool->self, eina_thread_self()));
@@ -288,7 +288,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
288 p = _eina_chained_mp_pool_new(pool); 288 p = _eina_chained_mp_pool_new(pool);
289 if (!p) 289 if (!p)
290 { 290 {
291 eina_lock_release(&pool->mutex); 291 eina_spinlock_release(&pool->mutex);
292 return NULL; 292 return NULL;
293 } 293 }
294 294
@@ -299,7 +299,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
299 299
300 mem = _eina_chained_mempool_alloc_in(pool, p); 300 mem = _eina_chained_mempool_alloc_in(pool, p);
301 301
302 eina_lock_release(&pool->mutex); 302 eina_spinlock_release(&pool->mutex);
303 303
304 return mem; 304 return mem;
305} 305}
@@ -312,7 +312,7 @@ eina_chained_mempool_free(void *data, void *ptr)
312 Chained_Pool *p; 312 Chained_Pool *p;
313 313
314 // look 4 pool 314 // look 4 pool
315 if (!eina_lock_take(&pool->mutex)) 315 if (!eina_spinlock_take(&pool->mutex))
316 { 316 {
317#ifdef EINA_HAVE_DEBUG_THREADS 317#ifdef EINA_HAVE_DEBUG_THREADS
318 assert(eina_thread_equal(pool->self, eina_thread_self())); 318 assert(eina_thread_equal(pool->self, eina_thread_self()));
@@ -343,7 +343,7 @@ eina_chained_mempool_free(void *data, void *ptr)
343 } 343 }
344#endif 344#endif
345 345
346 eina_lock_release(&pool->mutex); 346 eina_spinlock_release(&pool->mutex);
347 return; 347 return;
348} 348}
349 349
@@ -357,7 +357,7 @@ eina_chained_mempool_repack(void *data,
357 Chained_Pool *tail; 357 Chained_Pool *tail;
358 358
359 /* FIXME: Improvement - per Chained_Pool lock */ 359 /* FIXME: Improvement - per Chained_Pool lock */
360 if (!eina_lock_take(&pool->mutex)) 360 if (!eina_spinlock_take(&pool->mutex))
361 { 361 {
362#ifdef EINA_HAVE_DEBUG_THREADS 362#ifdef EINA_HAVE_DEBUG_THREADS
363 assert(eina_thread_equal(pool->self, eina_thread_self())); 363 assert(eina_thread_equal(pool->self, eina_thread_self()));
@@ -430,7 +430,7 @@ eina_chained_mempool_repack(void *data,
430 } 430 }
431 431
432 /* FIXME: improvement - reorder pool so that the most used one get in front */ 432 /* FIXME: improvement - reorder pool so that the most used one get in front */
433 eina_lock_release(&pool->mutex); 433 eina_spinlock_release(&pool->mutex);
434} 434}
435 435
436static void * 436static void *
@@ -486,7 +486,7 @@ eina_chained_mempool_init(const char *context,
486 mp->self = eina_thread_self(); 486 mp->self = eina_thread_self();
487#endif 487#endif
488 488
489 eina_lock_new(&mp->mutex); 489 eina_spinlock_new(&mp->mutex);
490 490
491 return mp; 491 return mp;
492} 492}
@@ -524,7 +524,7 @@ eina_chained_mempool_shutdown(void *data)
524 VALGRIND_DESTROY_MEMPOOL(mp); 524 VALGRIND_DESTROY_MEMPOOL(mp);
525#endif 525#endif
526 526
527 eina_lock_free(&mp->mutex); 527 eina_spinlock_free(&mp->mutex);
528 528
529#ifdef EINA_HAVE_DEBUG_THREADS 529#ifdef EINA_HAVE_DEBUG_THREADS
530 assert(eina_thread_equal(mp->self, eina_thread_self())); 530 assert(eina_thread_equal(mp->self, eina_thread_self()));