From 77721a5b5fe0e889448db0e8f7fa30459fb63502 Mon Sep 17 00:00:00 2001 From: discomfitor Date: Fri, 23 Jul 2010 03:39:52 +0000 Subject: [PATCH] api change to ecore_thread_pool_data_add, now has 4th argument "direct" to avoid copying key value if desired git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@50442 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore/Ecore.h | 2 +- src/lib/ecore/ecore_thread.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore/Ecore.h b/src/lib/ecore/Ecore.h index 98de188..3c7192a 100644 --- a/src/lib/ecore/Ecore.h +++ b/src/lib/ecore/Ecore.h @@ -348,7 +348,7 @@ extern "C" { const void *data, Eina_Bool try_no_queue); EAPI Eina_Bool ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, - const void *value); + const void *value, Eina_Bool direct); EAPI void *ecore_thread_pool_data_find(Ecore_Thread *thread, const char *key); EAPI Eina_Bool ecore_thread_pool_data_del(Ecore_Thread *thread, const char *key); EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread); diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c index b5a7ef0..6f15dbf 100644 --- a/src/lib/ecore/ecore_thread.c +++ b/src/lib/ecore/ecore_thread.c @@ -819,6 +819,7 @@ ecore_thread_available_get(void) * @param thread The thread context to add to * @param key The name string to add the data with * @param value The data to add + * @param direct If true, this will not copy the key string (like eina_hash_direct_add) * @return EINA_TRUE on success, EINA_FALSE on failure * This adds data to the thread context, allowing for subsequent users of the thread's pool * to retrieve and use it without complicated mutexing. This function can only be called by a @@ -827,7 +828,7 @@ ecore_thread_available_get(void) * functions to avoid leaks. */ EAPI Eina_Bool -ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, const void *value) +ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, const void *value, Eina_Bool direct) { Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread; if ((!thread) || (!key) || (!value)) @@ -840,13 +841,15 @@ ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, const void *va if (!worker->u.long_run.hash) return EINA_FALSE; - + if (direct) + return eina_hash_direct_add(worker->u.long_run.hash, key, value); return eina_hash_add(worker->u.long_run.hash, key, value); #else return EINA_TRUE; #endif } + /** * @brief Find data in the pool's data * @param thread The thread context -- 2.7.4