Recommended backend for Linux 5.11, and POSIX threads interop
Amirouche
amirouche at hyper.dev
Sat Aug 21 08:37:55 CEST 2021
Hello,
I am diving in to libev.
1) I want to understand what is the recommended backend; The pod
document goes into a long description of how epoll is broken, but then
it seems to me EPOLL is the recommended backend on Linux:
In ev.c here is the code that select the backend:
if (!(flags & EVBACKEND_MASK))
flags |= ev_recommended_backends ();
#if EV_USE_IOCP
if (!backend && (flags & EVBACKEND_IOCP )) backend = iocp_init
(EV_A_ flags);
#endif
#if EV_USE_PORT
if (!backend && (flags & EVBACKEND_PORT )) backend = port_init
(EV_A_ flags);
#endif
#if EV_USE_KQUEUE
if (!backend && (flags & EVBACKEND_KQUEUE )) backend =
kqueue_init (EV_A_ flags);
#endif
#if EV_USE_IOURING
if (!backend && (flags & EVBACKEND_IOURING )) backend =
iouring_init (EV_A_ flags);
#endif
#if EV_USE_LINUXAIO
if (!backend && (flags & EVBACKEND_LINUXAIO)) backend =
linuxaio_init (EV_A_ flags);
#endif
#if EV_USE_EPOLL
if (!backend && (flags & EVBACKEND_EPOLL )) backend = epoll_init
(EV_A_ flags);
#endif
#if EV_USE_POLL
if (!backend && (flags & EVBACKEND_POLL )) backend = poll_init
(EV_A_ flags);
#endif
#if EV_USE_SELECT
if (!backend && (flags & EVBACKEND_SELECT )) backend =
select_init (EV_A_ flags);
#endif
ev_prepare_init (&pending_w, pendingcb);
2) In the THREAD LOCKING EXAMPLE, the code rely on a mutex and a
condvar; Would it work better with CAS operation?
Best regards,
Amirouche
More information about the libev
mailing list