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

Comparing libev/ev.c (file contents):
Revision 1.307 by root, Sun Jul 19 07:20:41 2009 UTC vs.
Revision 1.311 by root, Wed Jul 29 09:36:05 2009 UTC

386# include <stdint.h> 386# include <stdint.h>
387# ifndef EFD_NONBLOCK 387# ifndef EFD_NONBLOCK
388# define EFD_NONBLOCK O_NONBLOCK 388# define EFD_NONBLOCK O_NONBLOCK
389# endif 389# endif
390# ifndef EFD_CLOEXEC 390# ifndef EFD_CLOEXEC
391# ifdef O_CLOEXEC
391# define EFD_CLOEXEC O_CLOEXEC 392# define EFD_CLOEXEC O_CLOEXEC
393# else
394# define EFD_CLOEXEC 02000000
395# endif
392# endif 396# endif
393# ifdef __cplusplus 397# ifdef __cplusplus
394extern "C" { 398extern "C" {
395# endif 399# endif
396int eventfd (unsigned int initval, int flags); 400int eventfd (unsigned int initval, int flags);
1057 1061
1058 for (;;) 1062 for (;;)
1059 { 1063 {
1060 int c = k << 1; 1064 int c = k << 1;
1061 1065
1062 if (c > N + HEAP0 - 1) 1066 if (c >= N + HEAP0)
1063 break; 1067 break;
1064 1068
1065 c += c + 1 < N + HEAP0 && ANHE_at (heap [c]) > ANHE_at (heap [c + 1]) 1069 c += c + 1 < N + HEAP0 && ANHE_at (heap [c]) > ANHE_at (heap [c + 1])
1066 ? 1 : 0; 1070 ? 1 : 0;
1067 1071
1103 1107
1104/* move an element suitably so it is in a correct place */ 1108/* move an element suitably so it is in a correct place */
1105inline_size void 1109inline_size void
1106adjustheap (ANHE *heap, int N, int k) 1110adjustheap (ANHE *heap, int N, int k)
1107{ 1111{
1108 if (k > HEAP0 && ANHE_at (heap [HPARENT (k)]) >= ANHE_at (heap [k])) 1112 if (k > HEAP0 && ANHE_at (heap [k]) <= ANHE_at (heap [HPARENT (k)]))
1109 upheap (heap, k); 1113 upheap (heap, k);
1110 else 1114 else
1111 downheap (heap, N, k); 1115 downheap (heap, N, k);
1112} 1116}
1113 1117
2671 return; 2675 return;
2672 2676
2673 assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0 && w->signum < EV_NSIG)); 2677 assert (("libev: ev_signal_start called with illegal signal number", w->signum > 0 && w->signum < EV_NSIG));
2674 2678
2675#if EV_MULTIPLICITY 2679#if EV_MULTIPLICITY
2676 assert (("libev: tried to attach to a signal from two different loops", 2680 assert (("libev: a signal must not be attached to two different loops",
2677 !signals [w->signum - 1].loop || signals [w->signum - 1].loop == loop)); 2681 !signals [w->signum - 1].loop || signals [w->signum - 1].loop == loop));
2678 2682
2679 signals [w->signum - 1].loop = EV_A; 2683 signals [w->signum - 1].loop = EV_A;
2680#endif 2684#endif
2681 2685

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines