raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3195cf6d5f8d3548c9d194fba3aed07c69e8551c

commit 3195cf6d5f8d3548c9d194fba3aed07c69e8551c
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Sat Jul 20 11:52:52 2019 +0100

    ecore - efl thread - remove mroe error case cnp code and share it
    
    more cnp code de-duplication
---
 src/lib/ecore/efl_thread.c | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/src/lib/ecore/efl_thread.c b/src/lib/ecore/efl_thread.c
index 761796d219..7ae263c902 100644
--- a/src/lib/ecore/efl_thread.c
+++ b/src/lib/ecore/efl_thread.c
@@ -605,6 +605,22 @@ _efl_thread_efl_object_parent_set(Eo *obj, Efl_Thread_Data 
*pd, Efl_Object *pare
    pd->loop = efl_provider_find(parent, EFL_LOOP_CLASS);
 }
 
+static void
+_task_run_pipe_fail_clear(Thread_Data *thdat, Efl_Thread_Data *pd)
+{
+   efl_del(pd->fd.in_handler);
+   efl_del(pd->fd.out_handler);
+   close(thdat->fd.in);
+   close(thdat->fd.out);
+   close(pd->fd.in);
+   close(pd->fd.out);
+   pd->fd.in_handler = NULL;
+   pd->fd.out_handler = NULL;
+   pd->fd.in = -1;
+   pd->fd.out = -1;
+   free(thdat);
+}
+
 EOLIAN static Eina_Future *
 _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
 {
@@ -689,35 +705,15 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
    if (pipe(pipe_to_thread) != 0)
      {
         ERR("Can't create to_thread control pipe");
-        efl_del(pd->fd.in_handler);
-        efl_del(pd->fd.out_handler);
-        close(thdat->fd.in);
-        close(thdat->fd.out);
-        close(pd->fd.in);
-        close(pd->fd.out);
-        pd->fd.in_handler = NULL;
-        pd->fd.out_handler = NULL;
-        pd->fd.in = -1;
-        pd->fd.out = -1;
-        free(thdat);
+        _task_run_pipe_fail_clear(thdat, pd);
         return NULL;
      }
    if (pipe(pipe_from_thread) != 0)
      {
         ERR("Can't create from_thread control pipe");
-        efl_del(pd->fd.in_handler);
-        efl_del(pd->fd.out_handler);
+        _task_run_pipe_fail_clear(thdat, pd);
         close(pipe_to_thread[0]);
         close(pipe_to_thread[1]);
-        close(thdat->fd.in);
-        close(thdat->fd.out);
-        close(pd->fd.in);
-        close(pd->fd.out);
-        pd->fd.in_handler = NULL;
-        pd->fd.out_handler = NULL;
-        pd->fd.in = -1;
-        pd->fd.out = -1;
-        free(thdat);
         return NULL;
      }
    thdat->ctrl.in  = pipe_from_thread[1]; // write - input to parent

-- 


Reply via email to