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

Comparing libev/ev.c (file contents):
Revision 1.78 by root, Thu Nov 8 21:08:56 2007 UTC vs.
Revision 1.79 by root, Fri Nov 9 15:15:20 2007 UTC

342 342
343 for (i = 0; i < eventcnt; ++i) 343 for (i = 0; i < eventcnt; ++i)
344 ev_feed_event (EV_A_ events [i], type); 344 ev_feed_event (EV_A_ events [i], type);
345} 345}
346 346
347static void 347inline void
348fd_event (EV_P_ int fd, int events) 348fd_event (EV_P_ int fd, int revents)
349{ 349{
350 ANFD *anfd = anfds + fd; 350 ANFD *anfd = anfds + fd;
351 struct ev_io *w; 351 struct ev_io *w;
352 352
353 for (w = (struct ev_io *)anfd->head; w; w = (struct ev_io *)((WL)w)->next) 353 for (w = (struct ev_io *)anfd->head; w; w = (struct ev_io *)((WL)w)->next)
354 { 354 {
355 int ev = w->events & events; 355 int ev = w->events & revents;
356 356
357 if (ev) 357 if (ev)
358 ev_feed_event (EV_A_ (W)w, ev); 358 ev_feed_event (EV_A_ (W)w, ev);
359 } 359 }
360}
361
362void
363ev_feed_fd_event (EV_P_ int fd, int revents)
364{
365 fd_event (EV_A_ fd, revents);
360} 366}
361 367
362/*****************************************************************************/ 368/*****************************************************************************/
363 369
364static void 370static void
552#endif 558#endif
553 errno = old_errno; 559 errno = old_errno;
554 } 560 }
555} 561}
556 562
563void
564ev_feed_signal_event (EV_P_ int signum)
565{
566#if EV_MULTIPLICITY
567 assert (("feeding signal events is only supported in the default loop", loop == default_loop));
568#endif
569
570 --signum;
571
572 if (signum < 0 || signum >= signalmax)
573 return;
574
575 signals [signum].gotsig = 0;
576
577 for (w = signals [signum].head; w; w = w->next)
578 ev_feed_event (EV_A_ (W)w, EV_SIGNAL);
579}
580
557static void 581static void
558sigcb (EV_P_ struct ev_io *iow, int revents) 582sigcb (EV_P_ struct ev_io *iow, int revents)
559{ 583{
560 WL w; 584 WL w;
561 int signum; 585 int signum;
567#endif 591#endif
568 gotsig = 0; 592 gotsig = 0;
569 593
570 for (signum = signalmax; signum--; ) 594 for (signum = signalmax; signum--; )
571 if (signals [signum].gotsig) 595 if (signals [signum].gotsig)
572 { 596 sigevent (EV_A_ signum + 1);
573 signals [signum].gotsig = 0;
574
575 for (w = signals [signum].head; w; w = w->next)
576 ev_feed_event (EV_A_ (W)w, EV_SIGNAL);
577 }
578} 597}
579 598
580static void 599static void
581siginit (EV_P) 600siginit (EV_P)
582{ 601{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines