[zeromq-dev] Questions

Steven McCoy steven.mccoy at miru.hk
Sat Dec 13 02:29:41 CET 2008


2008/12/12 Martin Sustrik <sustrik at fastmq.com>
>
> ... To achieve
> what you need, you'll have to use the file descriptor-based signaler
> (ysocketpair). Then you'll have to modify the pollset to include
> user-supplied file descriptors aside of those used internally by 0MQ.


For optimum performance on Linux you'll want to look at eventfds, but
support in current stable distributions is fruity as best as the user
API was introduced in glibc 2.8, otherwise with kernel 2.6.22+ and
earlier glibc you have to call it yourself.

http://www.kernel.org/doc/man-pages/online/pages/man2/eventfd.2.html

#include <sys/syscall.h>
static inline long eventfd(unsigned count) {
    return syscall(SYS_eventfd, count);
}

Seeing some of the code around maybe some platforms don't even include
the system call defines:

#ifndef SYS_eventfd
#if defined(__i386__)
#define SYS_eventfd 323
#elif defined(__x86_64__)
#define SYS_eventfd 284
#elif defined(__ia64__)
#define SYS_eventfd 1309
#elif defined(__PPC__)
#define SYS_eventfd 307
#elif defined(__s390__)
#define SYS_eventfd 318
#elif defined(__alpha__)
#define SYS_eventfd 478
#else
#error define SYS_eventfd for your arch!
#endif
#endif

--
Steve-o



More information about the zeromq-dev mailing list