| 50 | } |
| 51 | |
| 52 | bool Notifier::Init() { |
| 53 | if (0 != pipe(impl_->fds)) { |
| 54 | QLErr("pipe fail"); |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | // set nonblock for CoRead/CoWrite |
| 59 | { |
| 60 | for (int i{0}; i < 2; ++i) { |
| 61 | auto flags = fcntl(impl_->fds[i], F_GETFL, 0); |
| 62 | fcntl(impl_->fds[i], F_SETFL, flags | O_NONBLOCK); |
| 63 | } |
| 64 | } |
| 65 | return true; |
| 66 | } |
| 67 | |
| 68 | void Notifier::Notify(const comm::RetCode retcode) { |
| 69 | int iretcode = as_integer(retcode); |