Hi all,<br><br>The timercmp() macro provided by Solaris does not properly handle &lt;= or &gt;=.&nbsp; As a result, when timeout_next() is calculating how long to sleep and the next timeout occurs later in the current second, the code will call timerclear() and set the timeout to zero.&nbsp; This causes the main event loop to repeatedly call the dispatch function with a zero timeout until the timeout actually fires.
<br><br>I have included a patch which resolves the problem below.&nbsp; It should be fully backward compatible on systems with a working timercmp() -- I tested it on Linux.&nbsp; Another approach would be to update the autoconf stuff to check for the broken timercmp() and use the libevent built-in alternative.
<br><br>A<br><br>--- libevent-1.3b.dist/event.c&nbsp; 2007-02-15 19:49:06.000000000 -0500<br>+++ libevent-1.3b/event.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2007-03-12 18:30:30.568082270 -0400<br>@@ -726,7 +726,8 @@<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (gettime(&amp;now) == -1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<br>&nbsp;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (timercmp(&amp;ev-&gt;ev_timeout, &amp;now, &lt;=)) {<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Solaris timercmp macro does not properly handle &lt;= */<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!timercmp(&amp;ev-&gt;ev_timeout, &amp;now, &gt;)) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timerclear(tv);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }