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

Comparing libev/ev.c (file contents):
Revision 1.13 by root, Wed Oct 31 10:50:05 2007 UTC vs.
Revision 1.15 by root, Wed Oct 31 11:56:34 2007 UTC

83 83
84#define array_needsize(base,cur,cnt,init) \ 84#define array_needsize(base,cur,cnt,init) \
85 if ((cnt) > cur) \ 85 if ((cnt) > cur) \
86 { \ 86 { \
87 int newcnt = cur ? cur << 1 : 16; \ 87 int newcnt = cur ? cur << 1 : 16; \
88 fprintf (stderr, "resize(" # base ") from %d to %d\n", cur, newcnt);\
89 base = realloc (base, sizeof (*base) * (newcnt)); \ 88 base = realloc (base, sizeof (*base) * (newcnt)); \
90 init (base + cur, newcnt - cur); \ 89 init (base + cur, newcnt - cur); \
91 cur = newcnt; \ 90 cur = newcnt; \
92 } 91 }
93 92
538 { 537 {
539 block = MAX_BLOCKTIME; 538 block = MAX_BLOCKTIME;
540 539
541 if (timercnt) 540 if (timercnt)
542 { 541 {
543 ev_tstamp to = timers [0]->at - get_clock () + method_fudge; 542 ev_tstamp to = timers [0]->at - (have_monotonic ? get_clock () : ev_now) + method_fudge;
544 if (block > to) block = to; 543 if (block > to) block = to;
545 } 544 }
546 545
547 if (periodiccnt) 546 if (periodiccnt)
548 { 547 {
677 { 676 {
678 timers [w->active - 1] = timers [timercnt]; 677 timers [w->active - 1] = timers [timercnt];
679 downheap ((WT *)timers, timercnt, w->active - 1); 678 downheap ((WT *)timers, timercnt, w->active - 1);
680 } 679 }
681 680
681 w->at = w->repeat;
682
682 ev_stop ((W)w); 683 ev_stop ((W)w);
684}
685
686void
687evtimer_again (struct ev_timer *w)
688{
689 if (ev_is_active (w))
690 {
691 if (w->repeat)
692 {
693 w->at = now + w->repeat;
694 downheap ((WT *)timers, timercnt, w->active - 1);
695 }
696 else
697 evtimer_stop (w);
698 }
699 else if (w->repeat)
700 evtimer_start (w);
683} 701}
684 702
685void 703void
686evperiodic_start (struct ev_periodic *w) 704evperiodic_start (struct ev_periodic *w)
687{ 705{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines