aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore/ecore.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-08-09 12:17:47 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-08-09 12:17:47 +0000
commit6aefa60a0aed40e9e94abea8bff3a0c1ce7aa3d0 (patch)
tree5cae9126f8d7187389e1f49e91948926f26670a4 /legacy/ecore/src/lib/ecore/ecore.c
parenteet: don't copy string around. (diff)
downloadefl-6aefa60a0aed40e9e94abea8bff3a0c1ce7aa3d0.tar.gz
ecore: add ecore_fork_reset()
SVN revision: 75045
Diffstat (limited to 'legacy/ecore/src/lib/ecore/ecore.c')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore.c b/legacy/ecore/src/lib/ecore/ecore.c
index b7e47dc2b2..d8dc359bfc 100644
--- a/legacy/ecore/src/lib/ecore/ecore.c
+++ b/legacy/ecore/src/lib/ecore/ecore.c
@@ -80,6 +80,7 @@ static void _thread_callback(void *data,
static Eina_List *_thread_cb = NULL;
static Ecore_Pipe *_thread_call = NULL;
static Eina_Lock _thread_safety;
+static const int wakeup = 42;
static int _thread_loop = 0;
static Eina_Lock _thread_mutex;
@@ -175,11 +176,8 @@ ecore_init(void)
eina_condition_new(&_thread_cond, &_thread_mutex);
eina_lock_new(&_thread_feedback_mutex);
eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex);
- if (!_thread_call)
- {
- _thread_call = ecore_pipe_add(_thread_callback, NULL);
- eina_lock_new(&_thread_safety);
- }
+ _thread_call = ecore_pipe_add(_thread_callback, NULL);
+ eina_lock_new(&_thread_safety);
eina_lock_new(&_thread_id_lock);
@@ -307,12 +305,23 @@ unlock:
return _ecore_init_count;
}
+EAPI void
+ecore_fork_reset(void)
+{
+ eina_lock_take(&_thread_safety);
+
+ ecore_pipe_del(_thread_call);
+ _thread_call = ecore_pipe_add(_thread_callback, NULL);
+ /* If there was something in the pipe, trigger a wakeup again */
+ if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
+
+ eina_lock_release(&_thread_safety);
+}
+
/**
* @}
*/
-static int wakeup = 42;
-
EAPI void
ecore_main_loop_thread_safe_call_async(Ecore_Cb callback,
void *data)