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

Comparing libev/ev.c (file contents):
Revision 1.83 by root, Fri Nov 9 21:48:23 2007 UTC vs.
Revision 1.84 by root, Fri Nov 9 23:04:35 2007 UTC

518 518
519 heap [k] = w; 519 heap [k] = w;
520 ((W)heap [k])->active = k + 1; 520 ((W)heap [k])->active = k + 1;
521} 521}
522 522
523inline void
524adjustheap (WT *heap, int N, int k, ev_tstamp at)
525{
526 ev_tstamp old_at = heap [k]->at;
527 heap [k]->at = at;
528
529 if (old_at < at)
530 downheap (heap, N, k);
531 else
532 upheap (heap, k);
533}
534
523/*****************************************************************************/ 535/*****************************************************************************/
524 536
525typedef struct 537typedef struct
526{ 538{
527 WL head; 539 WL head;
1321ev_timer_again (EV_P_ struct ev_timer *w) 1333ev_timer_again (EV_P_ struct ev_timer *w)
1322{ 1334{
1323 if (ev_is_active (w)) 1335 if (ev_is_active (w))
1324 { 1336 {
1325 if (w->repeat) 1337 if (w->repeat)
1326 {
1327 ((WT)w)->at = mn_now + w->repeat;
1328 downheap ((WT *)timers, timercnt, ((W)w)->active - 1); 1338 adjustheap ((WT *)timers, timercnt, ((W)w)->active - 1, mn_now + w->repeat);
1329 }
1330 else 1339 else
1331 ev_timer_stop (EV_A_ w); 1340 ev_timer_stop (EV_A_ w);
1332 } 1341 }
1333 else if (w->repeat) 1342 else if (w->repeat)
1334 ev_timer_start (EV_A_ w); 1343 ev_timer_start (EV_A_ w);
1376} 1385}
1377 1386
1378void 1387void
1379ev_periodic_again (EV_P_ struct ev_periodic *w) 1388ev_periodic_again (EV_P_ struct ev_periodic *w)
1380{ 1389{
1390 /* TODO: use adjustheap and recalculation */
1381 ev_periodic_stop (EV_A_ w); 1391 ev_periodic_stop (EV_A_ w);
1382 ev_periodic_start (EV_A_ w); 1392 ev_periodic_start (EV_A_ w);
1383} 1393}
1384 1394
1385void 1395void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines