123456789101112131415161718 |
- #include <iostream>
- #include <poll.h>
- #include "Utils.h"
- int Utils::pollFileDescriptor(int fd, int timeoutMillis, const char* error) {
- struct pollfd fds;
- fds.fd = fd;
- fds.events = POLLIN;
- fds.revents = 0;
- int pollResult = poll(&fds, 1, timeoutMillis);
- if(pollResult == -1) {
- perror(error);
- }
- return pollResult;
- }
|