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

Comparing libev/ev.c (file contents):
Revision 1.451 by root, Tue Jan 22 05:18:28 2013 UTC vs.
Revision 1.455 by root, Sun Apr 28 12:45:20 2013 UTC

357 357
358#ifndef EV_HEAP_CACHE_AT 358#ifndef EV_HEAP_CACHE_AT
359# define EV_HEAP_CACHE_AT EV_FEATURE_DATA 359# define EV_HEAP_CACHE_AT EV_FEATURE_DATA
360#endif 360#endif
361 361
362#ifdef ANDROID
363/* supposedly, android doesn't typedef fd_mask */
364# undef EV_USE_SELECT
365# define EV_USE_SELECT 0
366/* supposedly, we need to include syscall.h, not sys/syscall.h, so just disable */
367# undef EV_USE_CLOCK_SYSCALL
368# define EV_USE_CLOCK_SYSCALL 0
369#endif
370
371/* aix's poll.h seems to cause lots of trouble */
372#ifdef _AIX
373/* AIX has a completely broken poll.h header */
374# undef EV_USE_POLL
375# define EV_USE_POLL 0
376#endif
377
362/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ 378/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */
363/* which makes programs even slower. might work on other unices, too. */ 379/* which makes programs even slower. might work on other unices, too. */
364#if EV_USE_CLOCK_SYSCALL 380#if EV_USE_CLOCK_SYSCALL
365# include <sys/syscall.h> 381# include <sys/syscall.h>
366# ifdef SYS_clock_gettime 382# ifdef SYS_clock_gettime
372# define EV_USE_CLOCK_SYSCALL 0 388# define EV_USE_CLOCK_SYSCALL 0
373# endif 389# endif
374#endif 390#endif
375 391
376/* this block fixes any misconfiguration where we know we run into trouble otherwise */ 392/* this block fixes any misconfiguration where we know we run into trouble otherwise */
377
378#ifdef _AIX
379/* AIX has a completely broken poll.h header */
380# undef EV_USE_POLL
381# define EV_USE_POLL 0
382#endif
383 393
384#ifndef CLOCK_MONOTONIC 394#ifndef CLOCK_MONOTONIC
385# undef EV_USE_MONOTONIC 395# undef EV_USE_MONOTONIC
386# define EV_USE_MONOTONIC 0 396# define EV_USE_MONOTONIC 0
387#endif 397#endif
505 515
506#ifndef ECB_H 516#ifndef ECB_H
507#define ECB_H 517#define ECB_H
508 518
509/* 16 bits major, 16 bits minor */ 519/* 16 bits major, 16 bits minor */
510#define ECB_VERSION 0x00010002 520#define ECB_VERSION 0x00010003
511 521
512#ifdef _WIN32 522#ifdef _WIN32
513 typedef signed char int8_t; 523 typedef signed char int8_t;
514 typedef unsigned char uint8_t; 524 typedef unsigned char uint8_t;
515 typedef signed short int16_t; 525 typedef signed short int16_t;
536 #include <inttypes.h> 546 #include <inttypes.h>
537 #if UINTMAX_MAX > 0xffffffffU 547 #if UINTMAX_MAX > 0xffffffffU
538 #define ECB_PTRSIZE 8 548 #define ECB_PTRSIZE 8
539 #else 549 #else
540 #define ECB_PTRSIZE 4 550 #define ECB_PTRSIZE 4
551 #endif
552#endif
553
554/* work around x32 idiocy by defining proper macros */
555#if __x86_64 || _M_AMD64
556 #if __ILP32
557 #define ECB_AMD64_X32 1
558 #else
559 #define ECB_AMD64 1
541 #endif 560 #endif
542#endif 561#endif
543 562
544/* many compilers define _GNUC_ to some versions but then only implement 563/* many compilers define _GNUC_ to some versions but then only implement
545 * what their idiot authors think are the "more important" extensions, 564 * what their idiot authors think are the "more important" extensions,
2085 ev_syserr ("(libev) error creating signal/async pipe"); 2104 ev_syserr ("(libev) error creating signal/async pipe");
2086 2105
2087 fd_intern (fds [0]); 2106 fd_intern (fds [0]);
2088 } 2107 }
2089 2108
2090 fd_intern (fds [1]);
2091
2092 evpipe [0] = fds [0]; 2109 evpipe [0] = fds [0];
2093 2110
2094 if (evpipe [1] < 0) 2111 if (evpipe [1] < 0)
2095 evpipe [1] = fds [1]; /* first call, set write fd */ 2112 evpipe [1] = fds [1]; /* first call, set write fd */
2096 else 2113 else
2101 /* so must not be executed on windows */ 2118 /* so must not be executed on windows */
2102 2119
2103 dup2 (fds [1], evpipe [1]); 2120 dup2 (fds [1], evpipe [1]);
2104 close (fds [1]); 2121 close (fds [1]);
2105 } 2122 }
2123
2124 fd_intern (evpipe [1]);
2106 2125
2107 ev_io_set (&pipe_w, evpipe [0] < 0 ? evpipe [1] : evpipe [0], EV_READ); 2126 ev_io_set (&pipe_w, evpipe [0] < 0 ? evpipe [1] : evpipe [0], EV_READ);
2108 ev_io_start (EV_A_ &pipe_w); 2127 ev_io_start (EV_A_ &pipe_w);
2109 ev_unref (EV_A); /* watcher should not keep loop alive */ 2128 ev_unref (EV_A); /* watcher should not keep loop alive */
2110 } 2129 }
2229 2248
2230void 2249void
2231ev_feed_signal (int signum) EV_THROW 2250ev_feed_signal (int signum) EV_THROW
2232{ 2251{
2233#if EV_MULTIPLICITY 2252#if EV_MULTIPLICITY
2253 EV_P;
2234 ECB_MEMORY_FENCE_ACQUIRE; 2254 ECB_MEMORY_FENCE_ACQUIRE;
2235 EV_P = signals [signum - 1].loop; 2255 EV_A = signals [signum - 1].loop;
2236 2256
2237 if (!EV_A) 2257 if (!EV_A)
2238 return; 2258 return;
2239#endif 2259#endif
2240 2260

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines