return ncur;
}
-inline_speed void *
+static noinline void *
array_realloc (int elem, void *base, int *cur, int cnt)
{
*cur = array_nextsize (elem, *cur, cnt);
ev_feed_event (EV_P_ void *w, int revents)
{
W w_ = (W)w;
+ int pri = ABSPRI (w_);
if (expect_false (w_->pending))
+ pendings [pri][w_->pending - 1].events |= revents;
+ else
{
- pendings [ABSPRI (w_)][w_->pending - 1].events |= revents;
- return;
+ w_->pending = ++pendingcnt [pri];
+ array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2);
+ pendings [pri][w_->pending - 1].w = w_;
+ pendings [pri][w_->pending - 1].events = revents;
}
-
- w_->pending = ++pendingcnt [ABSPRI (w_)];
- array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], EMPTY2);
- pendings [ABSPRI (w_)][w_->pending - 1].w = w_;
- pendings [ABSPRI (w_)][w_->pending - 1].events = revents;
}
void inline_size
ev_feed_signal_event (EV_A_ signum + 1);
}
-void inline_size
+void inline_speed
fd_intern (int fd)
{
#ifdef _WIN32
/*****************************************************************************/
-void
+void noinline
ev_io_start (EV_P_ ev_io *w)
{
int fd = w->fd;
fd_change (EV_A_ fd);
}
-void
+void noinline
ev_io_stop (EV_P_ ev_io *w)
{
clear_pending (EV_A_ (W)w);
fd_change (EV_A_ w->fd);
}
-void
+void noinline
ev_timer_start (EV_P_ ev_timer *w)
{
if (expect_false (ev_is_active (w)))
/*assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));*/
}
-void
+void noinline
ev_timer_stop (EV_P_ ev_timer *w)
{
clear_pending (EV_A_ (W)w);
ev_stop (EV_A_ (W)w);
}
-void
+void noinline
ev_timer_again (EV_P_ ev_timer *w)
{
if (ev_is_active (w))
}
#if EV_PERIODIC_ENABLE
-void
+void noinline
ev_periodic_start (EV_P_ ev_periodic *w)
{
if (expect_false (ev_is_active (w)))
/*assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));*/
}
-void
+void noinline
ev_periodic_stop (EV_P_ ev_periodic *w)
{
clear_pending (EV_A_ (W)w);
ev_stop (EV_A_ (W)w);
}
-void
+void noinline
ev_periodic_again (EV_P_ ev_periodic *w)
{
/* TODO: use adjustheap and recalculation */
# define SA_RESTART 0
#endif
-void
+void noinline
ev_signal_start (EV_P_ ev_signal *w)
{
#if EV_MULTIPLICITY
}
}
-void
+void noinline
ev_signal_stop (EV_P_ ev_signal *w)
{
clear_pending (EV_A_ (W)w);
(nev & EV_READ ? EPOLLIN : 0)
| (nev & EV_WRITE ? EPOLLOUT : 0);
- if (epoll_ctl (backend_fd, mode, fd, &ev))
+ if (expect_false (epoll_ctl (backend_fd, mode, fd, &ev)))
if (errno != ENOENT /* on ENOENT the fd went away, so try to do the right thing */
|| (nev && epoll_ctl (backend_fd, EPOLL_CTL_ADD, fd, &ev)))
fd_kill (EV_A_ fd);
int i;
int eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax, (int)ceil (timeout * 1000.));
- if (eventcnt < 0)
+ if (expect_false (eventcnt < 0))
{
if (errno != EINTR)
syserr ("(libev) epoll_wait");
res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts);
kqueue_changecnt = 0;
- if (res < 0)
+ if (expect_false (res < 0))
{
if (errno != EINTR)
syserr ("(libev) kevent");
#include <poll.h>
-static void
+void inline_size
pollidx_init (int *base, int count)
{
while (count--)
{
pollidxs [fd] = -1;
- if (idx < --pollcnt)
+ if (expect_true (idx < --pollcnt))
{
polls [idx] = polls [pollcnt];
pollidxs [polls [idx].fd] = idx;
int i;
int res = poll (polls, pollcnt, (int)ceil (timeout * 1000.));
- if (res < 0)
+ if (expect_false (res < 0))
{
if (errno == EBADF)
fd_ebadf (EV_A);
}
for (i = 0; i < pollcnt; ++i)
- if (polls [i].revents & POLLNVAL)
+ if (expect_false (polls [i].revents & POLLNVAL))
fd_kill (EV_A_ polls [i].fd);
else
fd_event (
int word = fd / NFDBITS;
int mask = 1UL << (fd % NFDBITS);
- if (vec_max < word + 1)
+ if (expect_false (vec_max < word + 1))
{
int new_max = word + 1;
res = select (vec_max * NFDBITS, (fd_set *)vec_ro, (fd_set *)vec_wo, 0, &tv);
- if (res < 0)
+ if (expect_false (res < 0))
{
#if EV_SELECT_IS_WINSOCKET
errno = WSAGetLastError ();
if (FD_ISSET (handle, (fd_set *)vec_ro)) events |= EV_READ;
if (FD_ISSET (handle, (fd_set *)vec_wo)) events |= EV_WRITE;
- if (events)
+ if (expect_true (events))
fd_event (EV_A_ fd, events);
}
}
events |= word_r & mask ? EV_READ : 0;
events |= word_w & mask ? EV_WRITE : 0;
- if (events)
+ if (expect_true (events))
fd_event (EV_A_ word * NFDBITS + bit, events);
}
}