summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2013-10-11 09:32:09 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2013-10-11 09:36:35 +0100
commitee155b771ddb8f063105f013c652b65f2ff663c1 (patch)
tree3298f9b589679e6fb6a18bd980224d480a7a031e /src/modules
parent68a4e85483ec50c12ef3984a33e42c3bdd373790 (diff)
Revert "Revert "eina: use Eina_Spinlock for Eina_Chained_Mempool.""
You can bet on reverting makes people speed up the process in fixing it. Revert the revert here now that Cedric fixed it in eina. This reverts commit 875e7cf74de68d05f6fd28d26ad8bddab7782316.
Diffstat (limited to 'src/modules')
-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 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()));