diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-12-06 18:54:13 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2010-12-06 18:54:13 +0300 |
commit | cd086c7c1558eb5816711f4fdc6e21524a01ddca (patch) | |
tree | ce46bfb674d32499eb21facff4fc8e9dac08f45d | |
parent | 869fc39f50473e135a6be72b13a10f987e46c57b (diff) |
uloop: add a flag for keeping the socket blocking
-rw-r--r-- | uloop.c | 2 | ||||
-rw-r--r-- | uloop.h | 1 |
2 files changed, 2 insertions, 1 deletions
@@ -236,7 +236,7 @@ int uloop_fd_add(struct uloop_fd *sock, unsigned int flags) unsigned int fl; int ret; - if (!sock->registered) { + if (!sock->registered && !(flags & ULOOP_BLOCKING)) { fl = fcntl(sock->fd, F_GETFL, 0); fl |= O_NONBLOCK; fcntl(sock->fd, F_SETFL, fl); @@ -39,6 +39,7 @@ typedef void (*uloop_timeout_handler)(struct uloop_timeout *t); #define ULOOP_READ (1 << 0) #define ULOOP_WRITE (1 << 1) #define ULOOP_EDGE_TRIGGER (1 << 2) +#define ULOOP_BLOCKING (1 << 3) struct uloop_fd { |