eloop: add counter sources
authorDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 17 May 2012 14:41:26 +0000 (16:41 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 17 May 2012 14:48:43 +0000 (16:48 +0200)
commit31550f31809dbc6e76f9a9146ad5c70f62366833
tree6da92b8519aa6912c0a2abae210668de050ab956
parent32baeeec9de5197be1ce715e68a34333c77d866c
eloop: add counter sources

Counter sources are based on the eventfd syscall of linux. Internally, is
uses a 64bit counter which is initialized to 0 and can be increased by the
caller. Whenever the value is non-zero, the fd is marked readable and we
call our callback. We read the 64bit integer (which resets it to 0) and
pass the current value to the callback.

This can be used to implement cross-process notification methods or to
have idle-sources as valid file-descriptors in an epoll set which could be
exported to other applications that are not compliant to our event loop.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/eloop.c
src/eloop.h