[PATCH] SELECT1: Fix fd_timeout with undefined contents in select loop.

Dominik Vogt dvogt at ffm.tc.iot.dtag.de
Wed Jul 28 11:03:48 CEST 2010


The return value of the timeval parameter of the select() function depends on
the operating system and should be considered as undefined.
---
 src/eventlistholder.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/eventlistholder.cpp b/src/eventlistholder.cpp
index 052b1ad..120907a 100644
--- a/src/eventlistholder.cpp
+++ b/src/eventlistholder.cpp
@@ -201,12 +201,11 @@ int EventListHolder::SNMPProcessPendingEvents()
 
   pevents_mutex.lock();
 
-  // do not allow select to block
-  fd_timeout.tv_sec = 0;
-  fd_timeout.tv_usec = 10;  // chosen a very small timeout
-  // in order to avoid busy looping but keep overall performance
-
   do {
+    // do not allow select to block
+    fd_timeout.tv_sec = 0;
+    fd_timeout.tv_usec = 10;  // chosen a very small timeout
+    // in order to avoid busy looping but keep overall performance
 
     // Set up Select
     m_eventList.GetFdSets(maxfds, readfds, writefds, exceptfds);
-- 
1.5.5.6


--azLHFNyN32YCQGCU
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment;
	filename="0002-SELECT1-Remove-delay-in-select-loop-in-SNMPProcessP.patch"



More information about the AGENTPP mailing list