Skip to content
Snippets Groups Projects
Commit 88adef59 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Solved a problem with timeout = 0 in the wait functions. Before, it got...

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.
parent 381bd64e
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment