summaryrefslogtreecommitdiff
path: root/src/modules/eina
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-10-10 17:31:54 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-10-11 11:08:17 +0900
commit12d34309c7c6e3f3041ee576afe93f9ca335059e (patch)
tree2aa564d0589196d793939f8a522b9dc95a1da80d /src/modules/eina
parentb9d8a7af3ac164f47f62329c278d1cf09d9b1346 (diff)
eina: use Eina_Spinlock for Eina_Chained_Mempool.
Diffstat (limited to 'src/modules/eina')
-rw-r--r--src/modules/eina/mp/chained_pool/eina_chained_mempool.c20
1 files changed, 10 insertions, 10 deletions
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 830ad67e53..e3fcb5963c 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
84#ifdef EINA_HAVE_DEBUG_THREADS 84#ifdef EINA_HAVE_DEBUG_THREADS
85 Eina_Thread self; 85 Eina_Thread self;
86#endif 86#endif
87 Eina_Lock mutex; 87 Eina_Spinlock mutex;
88}; 88};
89 89
90typedef struct _Chained_Pool Chained_Pool; 90typedef struct _Chained_Pool Chained_Pool;
@@ -268,7 +268,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
268 Chained_Pool *p = NULL; 268 Chained_Pool *p = NULL;
269 void *mem; 269 void *mem;
270 270
271 if (!eina_lock_take(&pool->mutex)) 271 if (!eina_spinlock_take(&pool->mutex))
272 { 272 {
273#ifdef EINA_HAVE_DEBUG_THREADS 273#ifdef EINA_HAVE_DEBUG_THREADS
274 assert(eina_thread_equal(pool->self, eina_thread_self())); 274 assert(eina_thread_equal(pool->self, eina_thread_self()));
@@ -294,7 +294,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
294 p = _eina_chained_mp_pool_new(pool); 294 p = _eina_chained_mp_pool_new(pool);
295 if (!p) 295 if (!p)
296 { 296 {
297 eina_lock_release(&pool->mutex); 297 eina_spinlock_release(&pool->mutex);
298 return NULL; 298 return NULL;
299 } 299 }
300 300
@@ -305,7 +305,7 @@ eina_chained_mempool_malloc(void *data, EINA_UNUSED unsigned int size)
305 305
306 mem = _eina_chained_mempool_alloc_in(pool, p); 306 mem = _eina_chained_mempool_alloc_in(pool, p);
307 307
308 eina_lock_release(&pool->mutex); 308 eina_spinlock_release(&pool->mutex);
309 309
310 return mem; 310 return mem;
311} 311}
@@ -318,7 +318,7 @@ eina_chained_mempool_free(void *data, void *ptr)
318 Chained_Pool *p; 318 Chained_Pool *p;
319 319
320 // look 4 pool 320 // look 4 pool
321 if (!eina_lock_take(&pool->mutex)) 321 if (!eina_spinlock_take(&pool->mutex))
322 { 322 {
323#ifdef EINA_HAVE_DEBUG_THREADS 323#ifdef EINA_HAVE_DEBUG_THREADS
324 assert(eina_thread_equal(pool->self, eina_thread_self())); 324 assert(eina_thread_equal(pool->self, eina_thread_self()));
@@ -349,7 +349,7 @@ eina_chained_mempool_free(void *data, void *ptr)
349 } 349 }
350#endif 350#endif
351 351
352 eina_lock_release(&pool->mutex); 352 eina_spinlock_release(&pool->mutex);
353 return; 353 return;
354} 354}
355 355
@@ -363,7 +363,7 @@ eina_chained_mempool_repack(void *data,
363 Chained_Pool *tail; 363 Chained_Pool *tail;
364 364
365 /* FIXME: Improvement - per Chained_Pool lock */ 365 /* FIXME: Improvement - per Chained_Pool lock */
366 if (!eina_lock_take(&pool->mutex)) 366 if (!eina_spinlock_take(&pool->mutex))
367 { 367 {
368#ifdef EINA_HAVE_DEBUG_THREADS 368#ifdef EINA_HAVE_DEBUG_THREADS
369 assert(eina_thread_equal(pool->self, eina_thread_self())); 369 assert(eina_thread_equal(pool->self, eina_thread_self()));
@@ -436,7 +436,7 @@ eina_chained_mempool_repack(void *data,
436 } 436 }
437 437
438 /* FIXME: improvement - reorder pool so that the most used one get in front */ 438 /* FIXME: improvement - reorder pool so that the most used one get in front */
439 eina_lock_release(&pool->mutex); 439 eina_spinlock_release(&pool->mutex);
440} 440}
441 441
442static void * 442static void *
@@ -492,7 +492,7 @@ eina_chained_mempool_init(const char *context,
492 mp->self = eina_thread_self(); 492 mp->self = eina_thread_self();
493#endif 493#endif
494 494
495 eina_lock_new(&mp->mutex); 495 eina_spinlock_new(&mp->mutex);
496 496
497 return mp; 497 return mp;
498} 498}
@@ -530,7 +530,7 @@ eina_chained_mempool_shutdown(void *data)
530 VALGRIND_DESTROY_MEMPOOL(mp); 530 VALGRIND_DESTROY_MEMPOOL(mp);
531#endif 531#endif
532 532
533 eina_lock_free(&mp->mutex); 533 eina_spinlock_free(&mp->mutex);
534 534
535#ifdef EINA_HAVE_DEBUG_THREADS 535#ifdef EINA_HAVE_DEBUG_THREADS
536 assert(eina_thread_equal(mp->self, eina_thread_self())); 536 assert(eina_thread_equal(mp->self, eina_thread_self()));