Browse Source

Microoptimise epoll_wait call

master
Con Kolivas 10 years ago
parent
commit
6274371ccf
  1. 4
      src/connector.c

4
src/connector.c

@ -413,12 +413,14 @@ void *receiver(void *arg)
while (unlikely(!cdata->accept)) while (unlikely(!cdata->accept))
cksleep_ms(100); cksleep_ms(100);
ret = epoll_wait(epfd, &event, 1, 1000); ret = epoll_wait(epfd, &event, 1, 1000);
if (unlikely(ret < 1)) {
if (unlikely(ret == -1)) { if (unlikely(ret == -1)) {
LOGEMERG("FATAL: Failed to epoll_wait in receiver"); LOGEMERG("FATAL: Failed to epoll_wait in receiver");
break; break;
} }
if (unlikely(!ret)) /* Nothing to service, still very unlikely */
continue; continue;
}
if (event.data.u64 < (uint64_t)serverfds) { if (event.data.u64 < (uint64_t)serverfds) {
ret = accept_client(cdata, epfd, event.data.u64); ret = accept_client(cdata, epfd, event.data.u64);
if (unlikely(ret < 0)) { if (unlikely(ret < 0)) {

Loading…
Cancel
Save