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

Comparing libev/ev.c (file contents):
Revision 1.79 by root, Fri Nov 9 15:15:20 2007 UTC vs.
Revision 1.81 by root, Fri Nov 9 17:07:59 2007 UTC

126#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */ 126#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
127#define MAX_BLOCKTIME 59.731 /* never wait longer than this time (to detect time jumps) */ 127#define MAX_BLOCKTIME 59.731 /* never wait longer than this time (to detect time jumps) */
128#define PID_HASHSIZE 16 /* size of pid hash table, must be power of two */ 128#define PID_HASHSIZE 16 /* size of pid hash table, must be power of two */
129/*#define CLEANUP_INTERVAL 300. /* how often to try to free memory and re-check fds */ 129/*#define CLEANUP_INTERVAL 300. /* how often to try to free memory and re-check fds */
130 130
131#ifdef EV_H
132# include EV_H
133#else
131#include "ev.h" 134# include "ev.h"
135#endif
132 136
133#if __GNUC__ >= 3 137#if __GNUC__ >= 3
134# define expect(expr,value) __builtin_expect ((expr),(value)) 138# define expect(expr,value) __builtin_expect ((expr),(value))
135# define inline inline 139# define inline inline
136#else 140#else
215 int events; 219 int events;
216} ANPENDING; 220} ANPENDING;
217 221
218#if EV_MULTIPLICITY 222#if EV_MULTIPLICITY
219 223
220struct ev_loop 224 struct ev_loop
221{ 225 {
222# define VAR(name,decl) decl; 226 #define VAR(name,decl) decl;
223# include "ev_vars.h" 227 #include "ev_vars.h"
224};
225# undef VAR 228 #undef VAR
229 };
226# include "ev_wrap.h" 230 #include "ev_wrap.h"
231
232 struct ev_loop default_loop_struct;
233 static struct ev_loop *default_loop;
227 234
228#else 235#else
229 236
230# define VAR(name,decl) static decl; 237 #define VAR(name,decl) static decl;
231# include "ev_vars.h" 238 #include "ev_vars.h"
232# undef VAR 239 #undef VAR
240
241 static int default_loop;
233 242
234#endif 243#endif
235 244
236/*****************************************************************************/ 245/*****************************************************************************/
237 246
561} 570}
562 571
563void 572void
564ev_feed_signal_event (EV_P_ int signum) 573ev_feed_signal_event (EV_P_ int signum)
565{ 574{
575 WL w;
576
566#if EV_MULTIPLICITY 577#if EV_MULTIPLICITY
567 assert (("feeding signal events is only supported in the default loop", loop == default_loop)); 578 assert (("feeding signal events is only supported in the default loop", loop == default_loop));
568#endif 579#endif
569 580
570 --signum; 581 --signum;
579} 590}
580 591
581static void 592static void
582sigcb (EV_P_ struct ev_io *iow, int revents) 593sigcb (EV_P_ struct ev_io *iow, int revents)
583{ 594{
584 WL w;
585 int signum; 595 int signum;
586 596
587#ifdef WIN32 597#ifdef WIN32
588 recv (sigpipe [0], &revents, 1, MSG_DONTWAIT); 598 recv (sigpipe [0], &revents, 1, MSG_DONTWAIT);
589#else 599#else
591#endif 601#endif
592 gotsig = 0; 602 gotsig = 0;
593 603
594 for (signum = signalmax; signum--; ) 604 for (signum = signalmax; signum--; )
595 if (signals [signum].gotsig) 605 if (signals [signum].gotsig)
596 sigevent (EV_A_ signum + 1); 606 ev_feed_signal_event (EV_A_ signum + 1);
597} 607}
598 608
599static void 609static void
600siginit (EV_P) 610siginit (EV_P)
601{ 611{
841} 851}
842 852
843#endif 853#endif
844 854
845#if EV_MULTIPLICITY 855#if EV_MULTIPLICITY
846struct ev_loop default_loop_struct;
847static struct ev_loop *default_loop;
848
849struct ev_loop * 856struct ev_loop *
850#else 857#else
851static int default_loop;
852
853int 858int
854#endif 859#endif
855ev_default_loop (int methods) 860ev_default_loop (int methods)
856{ 861{
857 if (sigpipe [0] == sigpipe [1]) 862 if (sigpipe [0] == sigpipe [1])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines