From 40ca0ea17911b177d069571a5bb6657f4088500d Mon Sep 17 00:00:00 2001 From: raster Date: Mon, 1 Dec 2008 10:13:16 +0000 Subject: [PATCH] flush should use select with a timeout and try write every 10th of a sec git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@37877 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_con/ecore_con.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 5e71b16..8148182 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -870,6 +870,17 @@ _ecore_con_server_free(Ecore_Con_Server *svr) t_start = ecore_time_get(); while ((svr->write_buf) && (!svr->dead)) { + fd_set rfds, wfds, exfds; + struct timeval tv; + + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_SET(svr->fd, &wfds); + FD_ZERO(&exfds); + FD_SET(svr->fd, &exfds); + tv.tv_sec = 0; + tv.tv_usec = 1000000 / 10; /* 1 1/10th of a sec */ + select(svr->fd + 1, &rfds, &wfds, &exfds, &tv); _ecore_con_server_flush(svr); t = ecore_time_get(); if ((t - t_start) > 0.5) @@ -905,6 +916,17 @@ _ecore_con_client_free(Ecore_Con_Client *cl) t_start = ecore_time_get(); while ((cl->buf) && (!cl->dead)) { + fd_set rfds, wfds, exfds; + struct timeval tv; + + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_SET(cl->fd, &wfds); + FD_ZERO(&exfds); + FD_SET(cl->fd, &exfds); + tv.tv_sec = 0; + tv.tv_usec = 1000000 / 10; /* 1 1/10th of a sec */ + select(cl->fd + 1, &rfds, &wfds, &exfds, &tv); _ecore_con_client_flush(cl); t = ecore_time_get(); if ((t - t_start) > 0.5) -- 2.7.4