Use poll instead of select

Close #637
This commit is contained in:
topjohnwu
2018-10-04 15:06:13 -04:00
parent 37860181d4
commit e8e39e0f3c
4 changed files with 23 additions and 23 deletions

View File

@@ -7,6 +7,7 @@
#include <stdio.h>
#include <dirent.h>
#include <pthread.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -78,6 +79,7 @@ void *xmmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset);
ssize_t xsendfile(int out_fd, int in_fd, off_t *offset, size_t count);
pid_t xfork();
int xpoll(struct pollfd *fds, nfds_t nfds, int timeout);
// misc.c

View File

@@ -394,3 +394,11 @@ pid_t xfork() {
}
return ret;
}
int xpoll(struct pollfd *fds, nfds_t nfds, int timeout) {
int ret = poll(fds, nfds, timeout);
if (ret == -1) {
PLOGE("poll");
}
return ret;
}