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

Reply via email to