summaryrefslogtreecommitdiff
path: root/legacy/ecore
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
parentaddf4cccd05a31cffb06427eb970f484c3dbfec6 (diff)
ecore: add ecore_fork_reset()
SVN revision: 75045
Diffstat (limited to '')
-rw-r--r--legacy/ecore/ChangeLog1
-rw-r--r--legacy/ecore/NEWS1
-rw-r--r--legacy/ecore/src/lib/ecore/Ecore.h3
-rw-r--r--legacy/ecore/src/lib/ecore/ecore.c23
4 files changed, 20 insertions, 8 deletions
diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog
index c9f654bebb..00b372f0f7 100644
--- a/legacy/ecore/ChangeLog
+++ b/legacy/ecore/ChangeLog
@@ -851,3 +851,4 @@
8512012-08-09 Cedric Bail 8512012-08-09 Cedric Bail
852 852
853 * Correctly shutdown Ecore_Thread. 853 * Correctly shutdown Ecore_Thread.
854 * Add a way to reset Ecore_Thread internal pipe after a fork via ecore_fork_reset.
diff --git a/legacy/ecore/NEWS b/legacy/ecore/NEWS
index 0500358030..ca58a1298f 100644
--- a/legacy/ecore/NEWS
+++ b/legacy/ecore/NEWS
@@ -6,6 +6,7 @@ Changes since Ecore 1.2.0:
6Additions: 6Additions:
7 * ecore: 7 * ecore:
8 - Add ecore_main_fd_handler_file_add() 8 - Add ecore_main_fd_handler_file_add()
9 - Add ecore_fork_reset()
9 * ecore_evas: 10 * ecore_evas:
10 - Add transparency support on Windows (GDI engine only) 11 - Add transparency support on Windows (GDI engine only)
11 - Add API functions to get/set an Ecore_Evas's profile. 12 - Add API functions to get/set an Ecore_Evas's profile.
diff --git a/legacy/ecore/src/lib/ecore/Ecore.h b/legacy/ecore/src/lib/ecore/Ecore.h
index 9140b473b6..3c8edb78d5 100644
--- a/legacy/ecore/src/lib/ecore/Ecore.h
+++ b/legacy/ecore/src/lib/ecore/Ecore.h
@@ -373,13 +373,14 @@ extern "C" {
373#endif 373#endif
374 374
375/** 375/**
376 * @defgroup Ecore_Init_Group Ecore initialization and shutdown functions. 376 * @defgroup Ecore_Init_Group Ecore initialization, shutdown functions and reset on fork.
377 * 377 *
378 * @{ 378 * @{
379 */ 379 */
380 380
381EAPI int ecore_init(void); 381EAPI int ecore_init(void);
382EAPI int ecore_shutdown(void); 382EAPI int ecore_shutdown(void);
383EAPI void ecore_fork_reset(void);
383 384
384/** 385/**
385 * @} 386 * @}
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,
80static Eina_List *_thread_cb = NULL; 80static Eina_List *_thread_cb = NULL;
81static Ecore_Pipe *_thread_call = NULL; 81static Ecore_Pipe *_thread_call = NULL;
82static Eina_Lock _thread_safety; 82static Eina_Lock _thread_safety;
83static const int wakeup = 42;
83 84
84static int _thread_loop = 0; 85static int _thread_loop = 0;
85static Eina_Lock _thread_mutex; 86static 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
308EAPI void
309ecore_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
314static int wakeup = 42;
315
316EAPI void 325EAPI void
317ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, 326ecore_main_loop_thread_safe_call_async(Ecore_Cb callback,
318 void *data) 327 void *data)