aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore/ecore.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-09-23 13:26:54 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-09-23 13:26:54 +0000
commit16fc15285692a9f97e9a9783d4c935b8571b6827 (patch)
tree23d9ac1c0c0a29ef99a816548a558795143d4be4 /legacy/ecore/src/lib/ecore/ecore.c
parenteina: correctly track lock when waiting for condition. (diff)
downloadefl-16fc15285692a9f97e9a9783d4c935b8571b6827.tar.gz
ecore: lock all broadcast.
SVN revision: 63567
Diffstat (limited to 'legacy/ecore/src/lib/ecore/ecore.c')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore.c b/legacy/ecore/src/lib/ecore/ecore.c
index db75622392..2560d912d9 100644
--- a/legacy/ecore/src/lib/ecore/ecore.c
+++ b/legacy/ecore/src/lib/ecore/ecore.c
@@ -87,6 +87,7 @@ static Eina_Condition _thread_feedback_cond;
static Eina_Lock _thread_id_lock;
static int _thread_id = -1;
static int _thread_id_max = 0;
+static int _thread_id_update = 0;
Eina_Lock _ecore_main_loop_lock;
int _ecore_main_lock_count;
@@ -361,9 +362,9 @@ ecore_thread_main_loop_begin(void)
eina_condition_new(&order->c, &order->m);
order->suspend = EINA_TRUE;
- eina_lock_take(&order->m);
_ecore_main_loop_thread_safe_call(order);
+ eina_lock_take(&order->m);
while (order->current_id != _thread_id)
eina_condition_wait(&order->c);
eina_lock_release(&order->m);
@@ -400,6 +401,7 @@ ecore_thread_main_loop_end(void)
current_id = _thread_id;
eina_lock_take(&_thread_mutex);
+ _thread_id_update = _thread_id;
eina_condition_broadcast(&_thread_cond);
eina_lock_release(&_thread_mutex);
@@ -675,11 +677,13 @@ _thread_callback(void *data __UNUSED__,
{
eina_lock_take(&_thread_mutex);
+ eina_lock_take(&call->m);
_thread_id = call->current_id;
-
eina_condition_broadcast(&call->c);
+ eina_lock_release(&call->m);
- eina_condition_wait(&_thread_cond);
+ while (_thread_id_update != _thread_id)
+ eina_condition_wait(&_thread_cond);
eina_lock_release(&_thread_mutex);
_thread_id = -1;