aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-09-15 11:15:46 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-09-15 11:15:46 +0000
commit8e9fbe56623a491dc53443b3be537f16ce8c13d7 (patch)
tree2cd5e61f86c06a92805b9eb64079aa3d5adb0a9e /legacy/ecore/src/lib/ecore
parentemotion: correctly destroy buffer. (diff)
downloadefl-8e9fbe56623a491dc53443b3be537f16ce8c13d7.tar.gz
ecore: prevent race condition when using sync call after begin/end.
SVN revision: 63407
Diffstat (limited to 'legacy/ecore/src/lib/ecore')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore.c b/legacy/ecore/src/lib/ecore/ecore.c
index f76a347fbe..c2e4c22249 100644
--- a/legacy/ecore/src/lib/ecore/ecore.c
+++ b/legacy/ecore/src/lib/ecore/ecore.c
@@ -79,6 +79,8 @@ static Eina_Lock _thread_safety;
static int _thread_loop = 0;
static Eina_Lock _thread_mutex;
static Eina_Condition _thread_cond;
+static Eina_Lock _thread_feedback_mutex;
+static Eina_Condition _thread_feedback_cond;
Eina_Lock _ecore_main_loop_lock;
int _ecore_main_lock_count;
@@ -159,6 +161,8 @@ ecore_init(void)
eina_lock_new(&_thread_safety);
eina_lock_new(&_thread_mutex);
eina_condition_new(&_thread_cond, &_thread_mutex);
+ eina_lock_new(&_thread_feedback_mutex);
+ eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex);
_thread_call = ecore_pipe_add(_thread_callback, NULL);
eina_lock_new(&_ecore_main_loop_lock);
@@ -208,6 +212,10 @@ ecore_shutdown(void)
ecore_pipe_del(_thread_call);
eina_lock_free(&_thread_safety);
+ eina_condition_free(&_thread_cond);
+ eina_lock_free(&_thread_mutex);
+ eina_condition_free(&_thread_feedback_cond);
+ eina_lock_free(&_thread_feedback_mutex);
if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
_ecore_poller_shutdown();
@@ -371,6 +379,10 @@ ecore_thread_main_loop_end(void)
eina_condition_broadcast(&_thread_cond);
+ eina_lock_take(&_thread_feedback_mutex);
+ eina_condition_wait(&_thread_feedback_cond);
+ eina_lock_release(&_thread_feedback_mutex);
+
return 0;
}
@@ -636,14 +648,17 @@ _thread_callback(void *data __UNUSED__,
{
if (call->suspend)
{
+ eina_lock_take(&_thread_mutex);
+
eina_condition_broadcast(&call->c);
- eina_lock_take(&_thread_mutex);
eina_condition_wait(&_thread_cond);
eina_lock_release(&_thread_mutex);
eina_main_loop_define();
+ eina_condition_broadcast(&_thread_feedback_cond);
+
_thread_safe_cleanup(call);
free(call);
}