| 53 | } |
| 54 | |
| 55 | void PidFdWaiter::Start() |
| 56 | { |
| 57 | event_fd_ = eventfd(0, EFD_CLOEXEC); |
| 58 | XASSERT(event_fd_ >= 0, "fail to create event fd"); |
| 59 | epoll_fd_ = epoll_create1(EPOLL_CLOEXEC); |
| 60 | XASSERT(epoll_fd_ >= 0, "fail to create epoll fd"); |
| 61 | |
| 62 | struct epoll_event ev; |
| 63 | ev.events = EPOLLIN; |
| 64 | ev.data.u64 = PackEventData(kEpollEventTerminate, 0); |
| 65 | XASSERT(!epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, event_fd_, &ev), |
| 66 | "fail to add event fd to epoll"); |
| 67 | |
| 68 | thread_ = std::make_unique<std::thread>(&PidFdWaiter::WaitWorker, this); |
| 69 | } |
| 70 | |
| 71 | void PidFdWaiter::Stop() |
| 72 | { |
nothing calls this directly
no outgoing calls
no test coverage detected