From 7340d67f42488a315c0dd1b892d7c5e528c766d0 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Tue, 23 Oct 2007 11:47:01 +0000 Subject: Poll with zero timeout Jean-Christian de Rivaz writes: The attached patch solve an issue I faced while using the libdbus-glib waiting for a D-Bus message or the end of a glib timer at the same time. This specific case of use generate a poll call with a zero timeout. On platformes with the glibc a zero timeout poll return immetiately even if there is no file descriptor event. But on platformes with uClibc a zero timeout poll block until a file descriptor event occurs. --- libc/sysdeps/linux/common/poll.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libc/sysdeps/linux') diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 4fc5a3267..47eb87d73 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -38,6 +38,10 @@ int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout) tval.tv_sec = timeout / 1000; tval.tv_nsec = (timeout % 1000) * 1000000; ts = &tval; + } else if (timeout == 0) { + tval.tv_sec = 0; + tval.tv_nsec = 0; + ts = &tval; } return ppoll(fds, nfds, ts, NULL); } -- cgit v1.2.3