summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-20 11:46:07 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-07-20 11:55:59 +0100
commit40800366b25a0a8ede2e4d329a744606d56b4714 (patch)
treed476dc16926c3d4a41c396e1bb75c5dd9d144c6b /src/lib/ecore
parent687b06fb3ff679c8d7464c9858365ea4eae4eaa3 (diff)
ecore - efl thread - remove more copy & paste in fd in clearing handling
move to common shared function to reduce c&p
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 f08be0e119..39329284ca 100644
--- a/src/lib/ecore/efl_thread.c
+++ b/src/lib/ecore/efl_thread.c
@@ -960,6 +960,15 @@ _efl_thread_efl_io_reader_eos_get(const Eo *obj EINA_UNUSED, Efl_Thread_Data *pd
960 return pd->fd.eos_read; 960 return pd->fd.eos_read;
961} 961}
962 962
963static void
964_io_writer_write_fd_in_clear(Efl_Thread_Data *pd)
965{
966 close(pd->fd.in);
967 pd->fd.in = -1;
968 efl_del(pd->fd.in_handler);
969 pd->fd.in_handler = NULL;
970}
971
963EOLIAN static Eina_Error 972EOLIAN static Eina_Error
964_efl_thread_efl_io_writer_write(Eo *obj, Efl_Thread_Data *pd, Eina_Slice *slice, Eina_Slice *remaining) 973_efl_thread_efl_io_writer_write(Eo *obj, Efl_Thread_Data *pd, Eina_Slice *slice, Eina_Slice *remaining)
965{ 974{
@@ -991,22 +1000,14 @@ _efl_thread_efl_io_writer_write(Eo *obj, Efl_Thread_Data *pd, Eina_Slice *slice,
991 efl_io_writer_can_write_set(obj, EINA_FALSE); 1000 efl_io_writer_can_write_set(obj, EINA_FALSE);
992 if (r == 0) 1001 if (r == 0)
993 { 1002 {
994 close(pd->fd.in); 1003 _io_writer_write_fd_in_clear(pd);
995 pd->fd.in = -1;
996 efl_del(pd->fd.in_handler);
997 pd->fd.in_handler = NULL;
998 _thread_exit_eval(obj, pd); 1004 _thread_exit_eval(obj, pd);
999 return EPIPE; 1005 return EPIPE;
1000 } 1006 }
1001 return 0; 1007 return 0;
1002err: 1008err:
1003 if ((pd->fd.in != -1) && (errno != EAGAIN)) 1009 if ((pd->fd.in != -1) && (errno != EAGAIN))
1004 { 1010 _io_writer_write_fd_in_clear(pd);
1005 close(pd->fd.in);
1006 pd->fd.in = -1;
1007 efl_del(pd->fd.in_handler);
1008 pd->fd.in_handler = NULL;
1009 }
1010 if (remaining) *remaining = *slice; 1011 if (remaining) *remaining = *slice;
1011 slice->len = 0; 1012 slice->len = 0;
1012 slice->mem = NULL; 1013 slice->mem = NULL;