16 if (pipe(wakeupPipe.data())) {
17 wakeupPipe[0] = wakeupPipe[1] = -1;
18 perror(
"Failed to open wakeup pipe");
36 if (write(wakeupPipe[1], &dummy,
sizeof(dummy)) == -1) {
47 pollfd{.fd = fd, .events = POLLIN, .revents = 0},
48 pollfd{.fd = wakeupPipe[0], .events = POLLIN, .revents = 0},
50 int pollResult =
::poll(fds.data(), fds.size(), 1000);
54 if (pollResult == -1) {
57 if (pollResult != 0) {
bool poll(int fd)
Waits for an event to occur on the given file descriptor.
void abort()
Aborts a poll in progress and any future poll attempts.
This file implemented 3 utility functions: