Hi all,
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.
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.
A
--- libevent-1.3b.dist/event.c 2007-02-15 19:49:06.000000000 -0500
+++ libevent-1.3b/event.c 2007-03-12 18:30:30.568082270 -0400
@@ -726,7 +726,8 @@
if (gettime(&now) == -1)
return (-1);
- if (timercmp(&ev->ev_timeout, &now, <=)) {
+ /* Solaris timercmp macro does not properly handle <= */
+ if (!timercmp(&ev->ev_timeout, &now, >)) {
timerclear(tv);
return (0);
}
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkey.org/mailman/listinfo/libevent-users