summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-20 11:52:52 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-20 11:55:59 +0100
commit3195cf6d5f8d3548c9d194fba3aed07c69e8551c (patch)
treec3f1a86aa75adea3157377e537ff8c10fe69e989 /src/lib/ecore
parent54b321d459b3f2a9050177da3f4e437b763a7bbe (diff)
ecore - efl thread - remove mroe error case cnp code and share it
more cnp code de-duplication
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/efl_thread.c40
1 files 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
605 pd->loop = efl_provider_find(parent, EFL_LOOP_CLASS); 605 pd->loop = efl_provider_find(parent, EFL_LOOP_CLASS);
606} 606}
607 607
608static void
609_task_run_pipe_fail_clear(Thread_Data *thdat, Efl_Thread_Data *pd)
610{
611 efl_del(pd->fd.in_handler);
612 efl_del(pd->fd.out_handler);
613 close(thdat->fd.in);
614 close(thdat->fd.out);
615 close(pd->fd.in);
616 close(pd->fd.out);
617 pd->fd.in_handler = NULL;
618 pd->fd.out_handler = NULL;
619 pd->fd.in = -1;
620 pd->fd.out = -1;
621 free(thdat);
622}
623
608EOLIAN static Eina_Future * 624EOLIAN static Eina_Future *
609_efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd) 625_efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
610{ 626{
@@ -689,35 +705,15 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
689 if (pipe(pipe_to_thread) != 0) 705 if (pipe(pipe_to_thread) != 0)
690 { 706 {
691 ERR("Can't create to_thread control pipe"); 707 ERR("Can't create to_thread control pipe");
692 efl_del(pd->fd.in_handler); 708 _task_run_pipe_fail_clear(thdat, pd);
693 efl_del(pd->fd.out_handler);
694 close(thdat->fd.in);
695 close(thdat->fd.out);
696 close(pd->fd.in);
697 close(pd->fd.out);
698 pd->fd.in_handler = NULL;
699 pd->fd.out_handler = NULL;
700 pd->fd.in = -1;
701 pd->fd.out = -1;
702 free(thdat);
703 return NULL; 709 return NULL;
704 } 710 }
705 if (pipe(pipe_from_thread) != 0) 711 if (pipe(pipe_from_thread) != 0)
706 { 712 {
707 ERR("Can't create from_thread control pipe"); 713 ERR("Can't create from_thread control pipe");
708 efl_del(pd->fd.in_handler); 714 _task_run_pipe_fail_clear(thdat, pd);
709 efl_del(pd->fd.out_handler);
710 close(pipe_to_thread[0]); 715 close(pipe_to_thread[0]);
711 close(pipe_to_thread[1]); 716 close(pipe_to_thread[1]);
712 close(thdat->fd.in);
713 close(thdat->fd.out);
714 close(pd->fd.in);
715 close(pd->fd.out);
716 pd->fd.in_handler = NULL;
717 pd->fd.out_handler = NULL;
718 pd->fd.in = -1;
719 pd->fd.out = -1;
720 free(thdat);
721 return NULL; 717 return NULL;
722 } 718 }
723 thdat->ctrl.in = pipe_from_thread[1]; // write - input to parent 719 thdat->ctrl.in = pipe_from_thread[1]; // write - input to parent