diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2012-08-09 12:17:47 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2012-08-09 12:17:47 +0000 |
commit | 6aefa60a0aed40e9e94abea8bff3a0c1ce7aa3d0 (patch) | |
tree | 5cae9126f8d7187389e1f49e91948926f26670a4 /legacy/ecore/src/lib/ecore/ecore.c | |
parent | addf4cccd05a31cffb06427eb970f484c3dbfec6 (diff) |
ecore: add ecore_fork_reset()
SVN revision: 75045
Diffstat (limited to '')
-rw-r--r-- | legacy/ecore/src/lib/ecore/ecore.c | 23 |
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, | |||
80 | static Eina_List *_thread_cb = NULL; | 80 | static Eina_List *_thread_cb = NULL; |
81 | static Ecore_Pipe *_thread_call = NULL; | 81 | static Ecore_Pipe *_thread_call = NULL; |
82 | static Eina_Lock _thread_safety; | 82 | static Eina_Lock _thread_safety; |
83 | static const int wakeup = 42; | ||
83 | 84 | ||
84 | static int _thread_loop = 0; | 85 | static int _thread_loop = 0; |
85 | static Eina_Lock _thread_mutex; | 86 | static Eina_Lock _thread_mutex; |
@@ -175,11 +176,8 @@ ecore_init(void) | |||
175 | eina_condition_new(&_thread_cond, &_thread_mutex); | 176 | eina_condition_new(&_thread_cond, &_thread_mutex); |
176 | eina_lock_new(&_thread_feedback_mutex); | 177 | eina_lock_new(&_thread_feedback_mutex); |
177 | eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex); | 178 | eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex); |
178 | if (!_thread_call) | 179 | _thread_call = ecore_pipe_add(_thread_callback, NULL); |
179 | { | 180 | eina_lock_new(&_thread_safety); |
180 | _thread_call = ecore_pipe_add(_thread_callback, NULL); | ||
181 | eina_lock_new(&_thread_safety); | ||
182 | } | ||
183 | 181 | ||
184 | eina_lock_new(&_thread_id_lock); | 182 | eina_lock_new(&_thread_id_lock); |
185 | 183 | ||
@@ -307,12 +305,23 @@ unlock: | |||
307 | return _ecore_init_count; | 305 | return _ecore_init_count; |
308 | } | 306 | } |
309 | 307 | ||
308 | EAPI void | ||
309 | ecore_fork_reset(void) | ||
310 | { | ||
311 | eina_lock_take(&_thread_safety); | ||
312 | |||
313 | ecore_pipe_del(_thread_call); | ||
314 | _thread_call = ecore_pipe_add(_thread_callback, NULL); | ||
315 | /* If there was something in the pipe, trigger a wakeup again */ | ||
316 | if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int)); | ||
317 | |||
318 | eina_lock_release(&_thread_safety); | ||
319 | } | ||
320 | |||
310 | /** | 321 | /** |
311 | * @} | 322 | * @} |
312 | */ | 323 | */ |
313 | 324 | ||
314 | static int wakeup = 42; | ||
315 | |||
316 | EAPI void | 325 | EAPI void |
317 | ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, | 326 | ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, |
318 | void *data) | 327 | void *data) |