From: mike_m Date: Fri, 12 Aug 2011 05:22:16 +0000 (+0000) Subject: ecore: Create a lockless ecore_event_handler_del X-Git-Tag: build/2012-07-04.173327~929 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc5cf60038b1886e8ec2118627eb7bf613cc9954;p=profile%2Fivi%2Fecore.git ecore: Create a lockless ecore_event_handler_del Signed-off-by: Mike McCormack git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@62375 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c index 4fa9e6a..9249044 100644 --- a/src/lib/ecore/ecore_events.c +++ b/src/lib/ecore/ecore_events.c @@ -171,10 +171,7 @@ ecore_event_handler_del(Ecore_Event_Handler *event_handler) "ecore_event_handler_del"); goto unlock; } - EINA_SAFETY_ON_TRUE_GOTO(event_handler->delete_me, unlock); - event_handler->delete_me = 1; - event_handlers_delete_list = eina_list_append(event_handlers_delete_list, event_handler); - data = event_handler->data; + data = _ecore_event_handler_del(event_handler); unlock: _ecore_unlock(); @@ -441,6 +438,15 @@ ecore_event_current_event_get(void) * @} */ +EAPI void * +_ecore_event_handler_del(Ecore_Event_Handler *event_handler) +{ + EINA_SAFETY_ON_TRUE_RETURN_VAL(event_handler->delete_me, NULL); + event_handler->delete_me = 1; + event_handlers_delete_list = eina_list_append(event_handlers_delete_list, event_handler); + return event_handler->data; +} + void _ecore_event_shutdown(void) { diff --git a/src/lib/ecore/ecore_job.c b/src/lib/ecore/ecore_job.c index b4a7079..dfaa94b 100644 --- a/src/lib/ecore/ecore_job.c +++ b/src/lib/ecore/ecore_job.c @@ -31,7 +31,7 @@ _ecore_job_init(void) void _ecore_job_shutdown(void) { - ecore_event_handler_del(_ecore_job_handler); + _ecore_event_handler_del(_ecore_job_handler); _ecore_job_handler = NULL; } diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h index 59b969a..adf8992 100644 --- a/src/lib/ecore/ecore_private.h +++ b/src/lib/ecore/ecore_private.h @@ -147,6 +147,7 @@ void _ecore_event_shutdown(void); int _ecore_event_exist(void); Ecore_Event *_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free, void *data); void _ecore_event_call(void); +void *_ecore_event_handler_del(Ecore_Event_Handler *event_handler); Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe); void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, Ecore_Timer *dc); diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c index 987294b..c5c66a2 100644 --- a/src/lib/ecore/ecore_thread.c +++ b/src/lib/ecore/ecore_thread.c @@ -839,7 +839,7 @@ _ecore_thread_shutdown(void) } if (_ecore_thread_global_hash) eina_hash_free(_ecore_thread_global_hash); - ecore_event_handler_del(del_handler); + _ecore_event_handler_del(del_handler); have_main_loop_thread = 0; del_handler = NULL;