ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.288 by root, Sat Apr 25 14:12:48 2009 UTC vs.
Revision 1.290 by root, Mon Jun 29 04:41:34 2009 UTC

57# endif 57# endif
58# ifndef EV_USE_MONOTONIC 58# ifndef EV_USE_MONOTONIC
59# define EV_USE_MONOTONIC 1 59# define EV_USE_MONOTONIC 1
60# endif 60# endif
61# endif 61# endif
62# elif !defined(EV_USE_CLOCK_SYSCALL)
63# define EV_USE_CLOCK_SYSCALL 0
62# endif 64# endif
63 65
64# if HAVE_CLOCK_GETTIME 66# if HAVE_CLOCK_GETTIME
65# ifndef EV_USE_MONOTONIC 67# ifndef EV_USE_MONOTONIC
66# define EV_USE_MONOTONIC 1 68# define EV_USE_MONOTONIC 1
324 326
325/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ 327/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */
326/* which makes programs even slower. might work on other unices, too. */ 328/* which makes programs even slower. might work on other unices, too. */
327#if EV_USE_CLOCK_SYSCALL 329#if EV_USE_CLOCK_SYSCALL
328# include <syscall.h> 330# include <syscall.h>
331# ifdef SYS_clock_gettime
329# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts)) 332# define clock_gettime(id, ts) syscall (SYS_clock_gettime, (id), (ts))
330# undef EV_USE_MONOTONIC 333# undef EV_USE_MONOTONIC
331# define EV_USE_MONOTONIC 1 334# define EV_USE_MONOTONIC 1
335# else
336# undef EV_USE_CLOCK_SYSCALL
337# define EV_USE_CLOCK_SYSCALL 0
338# endif
332#endif 339#endif
333 340
334#if EV_USE_EVENTFD 341#if EV_USE_EVENTFD
335/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ 342/* our minimum requirement is glibc 2.7 which has the stub, but not the header */
336# include <stdint.h> 343# include <stdint.h>
1948/* fetch new monotonic and realtime times from the kernel */ 1955/* fetch new monotonic and realtime times from the kernel */
1949/* also detetc if there was a timejump, and act accordingly */ 1956/* also detetc if there was a timejump, and act accordingly */
1950inline_speed void 1957inline_speed void
1951time_update (EV_P_ ev_tstamp max_block) 1958time_update (EV_P_ ev_tstamp max_block)
1952{ 1959{
1953 int i;
1954
1955#if EV_USE_MONOTONIC 1960#if EV_USE_MONOTONIC
1956 if (expect_true (have_monotonic)) 1961 if (expect_true (have_monotonic))
1957 { 1962 {
1963 int i;
1958 ev_tstamp odiff = rtmn_diff; 1964 ev_tstamp odiff = rtmn_diff;
1959 1965
1960 mn_now = get_clock (); 1966 mn_now = get_clock ();
1961 1967
1962 /* only fetch the realtime clock every 0.5*MIN_TIMEJUMP seconds */ 1968 /* only fetch the realtime clock every 0.5*MIN_TIMEJUMP seconds */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines