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

Comparing libev/ev.c (file contents):
Revision 1.481 by root, Thu Jun 1 20:25:50 2017 UTC vs.
Revision 1.485 by root, Mon Aug 13 10:01:19 2018 UTC

162# define EV_USE_EVENTFD 0 162# define EV_USE_EVENTFD 0
163# endif 163# endif
164 164
165#endif 165#endif
166 166
167/* OS X, in its infinite idiocy, actually HARDCODES
168 * a limit of 1024 into their select. Where people have brains,
169 * OS X engineers apparently have a vacuum. Or maybe they were
170 * ordered to have a vacuum, or they do anything for money.
171 * This might help. Or not.
172 * Note that this must be defined early, as other include files
173 * will rely on this define as well.
174 */
175#define _DARWIN_UNLIMITED_SELECT 1
176
167#include <stdlib.h> 177#include <stdlib.h>
168#include <string.h> 178#include <string.h>
169#include <fcntl.h> 179#include <fcntl.h>
170#include <stddef.h> 180#include <stddef.h>
171 181
208# ifndef EV_SELECT_IS_WINSOCKET 218# ifndef EV_SELECT_IS_WINSOCKET
209# define EV_SELECT_IS_WINSOCKET 1 219# define EV_SELECT_IS_WINSOCKET 1
210# endif 220# endif
211# undef EV_AVOID_STDIO 221# undef EV_AVOID_STDIO
212#endif 222#endif
213
214/* OS X, in its infinite idiocy, actually HARDCODES
215 * a limit of 1024 into their select. Where people have brains,
216 * OS X engineers apparently have a vacuum. Or maybe they were
217 * ordered to have a vacuum, or they do anything for money.
218 * This might help. Or not.
219 */
220#define _DARWIN_UNLIMITED_SELECT 1
221 223
222/* this block tries to deduce configuration from header-defined symbols and defaults */ 224/* this block tries to deduce configuration from header-defined symbols and defaults */
223 225
224/* try to deduce the maximum number of signals on this platform */ 226/* try to deduce the maximum number of signals on this platform */
225#if defined EV_NSIG 227#if defined EV_NSIG
1906 struct timespec ts; 1908 struct timespec ts;
1907 1909
1908 EV_TS_SET (ts, delay); 1910 EV_TS_SET (ts, delay);
1909 nanosleep (&ts, 0); 1911 nanosleep (&ts, 0);
1910#elif defined _WIN32 1912#elif defined _WIN32
1913 /* maybe this should round up, as ms is very low resolution */
1914 /* compared to select (µs) or nanosleep (ns) */
1911 Sleep ((unsigned long)(delay * 1e3)); 1915 Sleep ((unsigned long)(delay * 1e3));
1912#else 1916#else
1913 struct timeval tv; 1917 struct timeval tv;
1914 1918
1915 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */ 1919 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */
2471#endif 2475#endif
2472 { 2476 {
2473#ifdef _WIN32 2477#ifdef _WIN32
2474 WSABUF buf; 2478 WSABUF buf;
2475 DWORD sent; 2479 DWORD sent;
2476 buf.buf = &buf; 2480 buf.buf = (char *)&buf;
2477 buf.len = 1; 2481 buf.len = 1;
2478 WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0); 2482 WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);
2479#else 2483#else
2480 write (evpipe [1], &(evpipe [1]), 1); 2484 write (evpipe [1], &(evpipe [1]), 1);
2481#endif 2485#endif
3300void 3304void
3301ev_invoke_pending (EV_P) 3305ev_invoke_pending (EV_P)
3302{ 3306{
3303 pendingpri = NUMPRI; 3307 pendingpri = NUMPRI;
3304 3308
3305 while (pendingpri) /* pendingpri possibly gets modified in the inner loop */ 3309 do
3306 { 3310 {
3307 --pendingpri; 3311 --pendingpri;
3308 3312
3313 /* pendingpri possibly gets modified in the inner loop */
3309 while (pendingcnt [pendingpri]) 3314 while (pendingcnt [pendingpri])
3310 { 3315 {
3311 ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri]; 3316 ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri];
3312 3317
3313 p->w->pending = 0; 3318 p->w->pending = 0;
3314 EV_CB_INVOKE (p->w, p->events); 3319 EV_CB_INVOKE (p->w, p->events);
3315 EV_FREQUENT_CHECK; 3320 EV_FREQUENT_CHECK;
3316 } 3321 }
3317 } 3322 }
3323 while (pendingpri);
3318} 3324}
3319 3325
3320#if EV_IDLE_ENABLE 3326#if EV_IDLE_ENABLE
3321/* make idle watchers pending. this handles the "call-idle */ 3327/* make idle watchers pending. this handles the "call-idle */
3322/* only when higher priorities are idle" logic */ 3328/* only when higher priorities are idle" logic */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines