Hi all,<br><br>The timercmp() macro provided by Solaris does not properly handle <= or >=. 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. 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. It should be fully backward compatible on systems with a working timercmp() -- I tested it on Linux. 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 2007-02-15 19:49:06.000000000 -0500<br>+++ libevent-1.3b/event.c 2007-03-12 18:30:30.568082270 -0400<br>@@ -726,7 +726,8 @@<br> if (gettime(&now) == -1)<br>
return (-1);<br> <br>- if (timercmp(&ev->ev_timeout, &now, <=)) {<br>+ /* Solaris timercmp macro does not properly handle <= */<br>+ if (!timercmp(&ev->ev_timeout, &now, >)) {
<br> timerclear(tv);<br> return (0);<br> }