From 88adef5973b603a26bb7cc9e30360376abdb6c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu> Date: Mon, 30 Sep 2013 12:48:47 +0000 Subject: [PATCH] Solved a problem with timeout = 0 in the wait functions. Before, it got blocked with infinite timeout, now, it just checks the current state of the events and return immediatelly. --- src/events/eventserver.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/events/eventserver.cpp b/src/events/eventserver.cpp index d30d81a..fbd69b1 100644 --- a/src/events/eventserver.cpp +++ b/src/events/eventserver.cpp @@ -202,7 +202,7 @@ int CEventServer::wait_first(std::list<std::string> events,int timeout) bool end=false; timeval time; - if(timeout>0) + if(timeout>=0) { time_out.set(timeout); time=time_out.getTimeInTimeval(); @@ -231,7 +231,7 @@ int CEventServer::wait_first(std::list<std::string> events,int timeout) } this->access_events.exit(); - if(timeout>0) + if(timeout>=0) error=select(max_fd+1,&wait_set,NULL,NULL,&time); else error=select(max_fd+1,&wait_set,NULL,NULL,NULL); @@ -291,7 +291,7 @@ void CEventServer::wait_all(std::list<std::string> events,int timeout) CTime time_out; timeval time; - if(timeout>0) + if(timeout>=0) { time_out.set(timeout); time=time_out.getTimeInTimeval(); @@ -320,7 +320,7 @@ void CEventServer::wait_all(std::list<std::string> events,int timeout) } } this->access_events.exit(); - if(timeout>0) + if(timeout>=0) error=select(max_fd+1,&wait_set,NULL,NULL,&time); else error=select(max_fd+1,&wait_set,NULL,NULL,NULL); @@ -360,7 +360,7 @@ void CEventServer::wait_all(std::list<std::string> events,int timeout) end=true; else { - if(timeout>0) + if(timeout>=0) time=time_out.getTimeInTimeval(); } } -- GitLab