From 031e9a9039ae644a9bc05e1a974bcb17fe9f1722 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 24 Oct 2012 17:00:48 +0200 Subject: [PATCH] eloop: fix ev_fd_update() to do nothing if the mask does not change If the new mask is equal to the old mask, we shouldn't change anything. This improves performance and avoids syscalls when they aren't needed. Signed-off-by: David Herrmann --- src/eloop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/eloop.c b/src/eloop.c index eabfeb2..dafb0b2 100644 --- a/src/eloop.c +++ b/src/eloop.c @@ -1300,6 +1300,8 @@ int ev_fd_update(struct ev_fd *fd, int mask) if (!fd) return -EINVAL; + if (fd->mask == mask) + return 0; omask = fd->mask; fd->mask = mask;