diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2007-10-23 11:47:01 +0000 |
---|---|---|
committer | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2007-10-23 11:47:01 +0000 |
commit | 7340d67f42488a315c0dd1b892d7c5e528c766d0 (patch) | |
tree | 9bed9c41791c47647b28dd5be3e5457a8cbe5f5b /libc/sysdeps/linux | |
parent | 77b4b9f9b6277e21af26bd80cdaf3924f818d7a0 (diff) |
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.
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r-- | libc/sysdeps/linux/common/poll.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); } |