| 99 | } |
| 100 | |
| 101 | UnixIoThread::UnixIoThread() noexcept: mThread(_new<AThread>([&] { |
| 102 | AThread::setName("AUI IO"); |
| 103 | UnixIoEventLoop loop(*this); |
| 104 | IEventLoop::Handle handle(&loop); |
| 105 | AThread::current()->getCurrentEventLoop()->loop(); |
| 106 | })), mEpollFd(epoll_create1(0)) { |
| 107 | registerCallback(mNotifyEvent.handle(), UnixPollEvent::IN, [this](ABitField<UnixPollEvent> f) { |
| 108 | mNotifyEvent.reset(); |
| 109 | }); |
| 110 | |
| 111 | mThread->start(); |
| 112 | AFuture<> cs; |
| 113 | mThread->enqueue([&] { |
| 114 | cs.supplyValue(); |
| 115 | }); |
| 116 | cs.wait(); |
| 117 | } |
| 118 | |
| 119 | #else |
| 120 | |