aboutsummaryrefslogtreecommitdiffstats
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
parenteet: use Eina_Spinlock instead of Eina_Lock for Eet_Dictionary. (diff)
downloadefl-12d34309c7c6e3f3041ee576afe93f9ca335059e.tar.gz
eina: use Eina_Spinlock for Eina_Chained_Mempool.
-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 892a7a8415..9113fc174c 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 00c4dbda5b..64bb665ec2 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 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
#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()));