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

Comparing libev/ev.c (file contents):
Revision 1.303 by root, Sun Jul 19 01:36:34 2009 UTC vs.
Revision 1.305 by root, Sun Jul 19 03:49:04 2009 UTC

186# endif 186# endif
187#endif 187#endif
188 188
189/* this block tries to deduce configuration from header-defined symbols and defaults */ 189/* this block tries to deduce configuration from header-defined symbols and defaults */
190 190
191/* try to deduce the maximum number of signals on this platform */
192#if defined (EV_NSIG)
193/* use what's provided */
194#elif defined (NSIG)
195# define EV_NSIG (NSIG)
196#elif defined(_NSIG)
197# define EV_NSIG (_NSIG)
198#elif defined (SIGMAX)
199# define EV_NSIG (SIGMAX+1)
200#elif defined (SIG_MAX)
201# define EV_NSIG (SIG_MAX+1)
202#elif defined (_SIG_MAX)
203# define EV_NSIG (_SIG_MAX+1)
204#elif defined (MAXSIG)
205# define EV_NSIG (MAXSIG+1)
206#elif defined (MAX_SIG)
207# define EV_NSIG (MAX_SIG+1)
208#elif defined (SIGARRAYSIZE)
209# define EV_NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
210#elif defined (_sys_nsig)
211# define EV_NSIG (_sys_nsig) /* Solaris 2.5 */
212#else
213# error "unable to find value for NSIG, please report"
214/* to make it compile regardless, just remove the above line */
215# define EV_NSIG 64
216#endif
217
218/* Default to some arbitrary number that's big enough to get most
219 of the common signals.
220*/
221#ifndef NSIG
222# define NSIG 50
223#endif
224/* <-- NSIG logic from Configure */
191#ifndef EV_USE_CLOCK_SYSCALL 225#ifndef EV_USE_CLOCK_SYSCALL
192# if __linux && __GLIBC__ >= 2 226# if __linux && __GLIBC__ >= 2
193# define EV_USE_CLOCK_SYSCALL 1 227# define EV_USE_CLOCK_SYSCALL 1
194# else 228# else
195# define EV_USE_CLOCK_SYSCALL 0 229# define EV_USE_CLOCK_SYSCALL 0
1630#if EV_IDLE_ENABLE 1664#if EV_IDLE_ENABLE
1631 array_free (idle, [i]); 1665 array_free (idle, [i]);
1632#endif 1666#endif
1633 } 1667 }
1634 1668
1635 ev_free (anfds); anfdmax = 0; 1669 ev_free (anfds); anfds = 0; anfdmax = 0;
1636 1670
1637 /* have to use the microsoft-never-gets-it-right macro */ 1671 /* have to use the microsoft-never-gets-it-right macro */
1638 array_free (rfeed, EMPTY); 1672 array_free (rfeed, EMPTY);
1639 array_free (fdchange, EMPTY); 1673 array_free (fdchange, EMPTY);
1640 array_free (timer, EMPTY); 1674 array_free (timer, EMPTY);
2683#endif 2717#endif
2684 2718
2685 array_needsize (ANSIG, signals, signalmax, w->signum, array_init_zero); 2719 array_needsize (ANSIG, signals, signalmax, w->signum, array_init_zero);
2686 2720
2687#ifndef _WIN32 2721#ifndef _WIN32
2722# if EV_USE_SIGNALFD
2688 if (sigfd < 0)/*TODO*/ 2723 if (sigfd < 0)/*TODO*/
2724# endif
2689 sigdelset (&prev, w->signum); 2725 sigdelset (&prev, w->signum);
2690 sigprocmask (SIG_SETMASK, &prev, 0); 2726 sigprocmask (SIG_SETMASK, &prev, 0);
2691#endif 2727#endif
2692 } 2728 }
2693 2729
2697 if (!((WL)w)->next) 2733 if (!((WL)w)->next)
2698 { 2734 {
2699#if _WIN32 2735#if _WIN32
2700 signal (w->signum, ev_sighandler); 2736 signal (w->signum, ev_sighandler);
2701#else 2737#else
2738# if EV_USE_SIGNALFD
2702 if (sigfd < 0) /*TODO*/ 2739 if (sigfd < 0) /*TODO*/
2740# endif
2703 { 2741 {
2704 struct sigaction sa = { }; 2742 struct sigaction sa = { };
2705 sa.sa_handler = ev_sighandler; 2743 sa.sa_handler = ev_sighandler;
2706 sigfillset (&sa.sa_mask); 2744 sigfillset (&sa.sa_mask);
2707 sa.sa_flags = SA_RESTART; /* if restarting works we save one iteration */ 2745 sa.sa_flags = SA_RESTART; /* if restarting works we save one iteration */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines