Re: [Libevent-users] busy waiting on AIX (timercmp bug)
On Mon, Mar 09, 2009 at 01:57:46PM +0100, Richter, J?rg wrote: [...] > Note that the Linux definition has the same comment about the > compare operator as the AIX one. But the comment seems to predate > the Linux definition. I'd guess that the comment is there because, if you're writing a portable program, you need to make sure that you don't use timercmp with <=/>=, even if it _does_ happen to work on Linux. [...] > I found no official documentation if timercmp should support <= or >=. > > I would suggest using always the libevent definition of timercmp, > without ever using the system one. That's a good idea! We already did it back in 1.4.4, which was released last May. The latest stable libevent release is 1.4.9. yrs, -- Nick ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
[Libevent-users] busy waiting on AIX (timercmp bug)
Hi, I just have a longish debugging session behind me finding out why a process is doing so many poll()s without doing real work. But this only happens on AIX. It turns out that the timercmp macro in combination with <= operator does not work. (used in event.c in libevent-1.4.2-rc2) This is the definition on AIX: /* * Operations on timevals. * * Note that timercmp only works for cmp values of !=, >, and <. */ ... #define timercmp(tvp, fvp, cmp) \ ((tvp)->tv_sec cmp (fvp)->tv_sec || \ (tvp)->tv_sec == (fvp)->tv_sec && \ (tvp)->tv_usec cmp (fvp)->tv_usec) - Here the definition of timercmp on Linux: /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ ... # define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) Note that the Linux definition has the same comment about the compare operator as the AIX one. But the comment seems to predate the Linux definition. I found no official documentation if timercmp should support <= or >=. I would suggest using always the libevent definition of timercmp, without ever using the system one. Jörg ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users