From f441859bfb77f5febc388d60e852ee8b2d4bc05c Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 24 Jun 2016 16:44:59 -0700 Subject: [PATCH] ecore: add the possibility to return an exit code when leaving the main loop. --- src/lib/ecore/ecore_main.c | 7 +++++-- src/lib/ecore/efl_loop.eo | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index e8c1d45a1d..a35a2c7b21 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -273,6 +273,7 @@ static int _ecore_main_win32_select(int nfds, static void _ecore_main_win32_handlers_cleanup(void); #endif +static unsigned char _ecore_exit_code = 0; static int in_main_loop = 0; static int do_quit = 0; static Ecore_Fd_Handler *fd_handlers = NULL; @@ -2733,16 +2734,18 @@ EOLIAN static int _efl_loop_iterate_may_block(Eo *obj EINA_UNUSED, Efl_Loop_Data return ecore_main_loop_iterate_may_block(may_block); } -EOLIAN static void +EOLIAN static unsigned char _efl_loop_begin(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED) { ecore_main_loop_begin(); + return _ecore_exit_code; } EOLIAN static void -_efl_loop_quit(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED) +_efl_loop_quit(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd EINA_UNUSED, unsigned char exit_code) { ecore_main_loop_quit(); + _ecore_exit_code = exit_code; } EOLIAN static Eo_Base * diff --git a/src/lib/ecore/efl_loop.eo b/src/lib/ecore/efl_loop.eo index 77af2885fb..0d00ee7971 100644 --- a/src/lib/ecore/efl_loop.eo +++ b/src/lib/ecore/efl_loop.eo @@ -29,10 +29,14 @@ class Efl.Loop (Eo.Base) } begin { [[Runs the application main loop.]] + return: ubyte; [[Value set by quit()]] } quit { [[Quits the main loop once all the events currently on the queue have been processed.]] + params { + @in exit_code: ubyte; [[Returned value by begin()]] + } } job { [[Will execute that promise in the near future.]]