summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-20 11:48:30 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-20 11:55:59 +0100
commit54b321d459b3f2a9050177da3f4e437b763a7bbe (patch)
treea89a3fd24ab5525f913d3c372f1dfc9ac0e2f5a2 /src/lib/ecore
parent40800366b25a0a8ede2e4d329a744606d56b4714 (diff)
ecore - efl thread - move duplicate code into shared func to reduce cnp
more copy & paste code - put into shared func.
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/efl_thread.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib/ecore/efl_thread.c b/src/lib/ecore/efl_thread.c
index 39329284ca..761796d219 100644
--- a/src/lib/ecore/efl_thread.c
+++ b/src/lib/ecore/efl_thread.c
@@ -872,6 +872,15 @@ _efl_thread_efl_io_closer_closed_get(const Eo *obj EINA_UNUSED, Efl_Thread_Data
872 return EINA_FALSE; 872 return EINA_FALSE;
873} 873}
874 874
875static void
876_io_reader_read_fd_out_clear(Efl_Thread_Data *pd)
877{
878 close(pd->fd.out);
879 pd->fd.out = -1;
880 efl_del(pd->fd.out_handler);
881 pd->fd.out_handler = NULL;
882}
883
875EOLIAN static Eina_Error 884EOLIAN static Eina_Error
876_efl_thread_efl_io_reader_read(Eo *obj, Efl_Thread_Data *pd, Eina_Rw_Slice *rw_slice) 885_efl_thread_efl_io_reader_read(Eo *obj, Efl_Thread_Data *pd, Eina_Rw_Slice *rw_slice)
877{ 886{
@@ -897,22 +906,14 @@ _efl_thread_efl_io_reader_read(Eo *obj, Efl_Thread_Data *pd, Eina_Rw_Slice *rw_s
897 { 906 {
898 efl_io_reader_can_read_set(obj, EINA_FALSE); 907 efl_io_reader_can_read_set(obj, EINA_FALSE);
899 efl_io_reader_eos_set(obj, EINA_TRUE); 908 efl_io_reader_eos_set(obj, EINA_TRUE);
900 close(pd->fd.out); 909 _io_reader_read_fd_out_clear(pd);
901 pd->fd.out = -1;
902 efl_del(pd->fd.out_handler);
903 pd->fd.out_handler = NULL;
904 _thread_exit_eval(obj, pd); 910 _thread_exit_eval(obj, pd);
905 return EPIPE; 911 return EPIPE;
906 } 912 }
907 return 0; 913 return 0;
908err: 914err:
909 if ((pd->fd.out != -1) && (errno != EAGAIN)) 915 if ((pd->fd.out != -1) && (errno != EAGAIN))
910 { 916 _io_reader_read_fd_out_clear(pd);
911 close(pd->fd.out);
912 pd->fd.out = -1;
913 efl_del(pd->fd.out_handler);
914 pd->fd.out_handler = NULL;
915 }
916 rw_slice->len = 0; 917 rw_slice->len = 0;
917 rw_slice->mem = NULL; 918 rw_slice->mem = NULL;
918 efl_io_reader_can_read_set(obj, EINA_FALSE); 919 efl_io_reader_can_read_set(obj, EINA_FALSE);