21 #include <system_error>
28 const int read_fd = 0;
29 const int write_fd = 1;
35 throw std::system_error(errno, std::system_category());
40 fds[0] = ::dup(rhs.fds[0]);
41 fds[1] = ::dup(rhs.fds[1]);
54 fds[0] = ::dup(rhs.fds[0]);
55 fds[1] = ::dup(rhs.fds[1]);
57 counter = rhs.counter;
64 static const short empty_revents = 0;
65 pollfd poll_fd[1] = { { fds[write_fd], POLLOUT, empty_revents } };
68 if ((rc = ::poll(poll_fd, 1, duration.count())) < 0)
69 throw std::system_error(errno, std::system_category());
73 static const std::uint32_t value = 1;
74 if (
sizeof(value) != write(fds[write_fd], std::addressof(value),
sizeof(value)))
75 throw std::system_error(errno, std::system_category());
80 static const short empty_revents = 0;
81 pollfd poll_fd[1] = { { fds[read_fd], POLLIN, empty_revents } };
84 if ((rc = ::poll(poll_fd, 1, duration.count())) < 0)
85 throw std::system_error(errno, std::system_category());
89 std::uint32_t value = 0;
90 if (
sizeof(value) != read(fds[read_fd], std::addressof(value),
sizeof(value)))
91 throw std::system_error(errno, std::system_category());
94 throw std::system_error(errno, std::system_category());