示例#1
0
bool SelectPoll::init()
{
    if(!notifier_.init()) {
        return false;
    }
    IOCallback cb ([this] (uint32_t ev) { notifier_.onEvent(ev); });
    registerFd(notifier_.getReadFD(), KUMA_EV_READ|KUMA_EV_ERROR, std::move(cb));
    return true;
}
示例#2
0
文件: EPoll.cpp 项目: zhaowolong/kuma
bool EPoll::init()
{
    epoll_fd_ = epoll_create(MAX_EPOLL_FDS);
    if(INVALID_FD == epoll_fd_) {
        return false;
    }
    if(!notifier_.init()) {
        return false;
    }
    IOCallback cb ([this](uint32_t ev) { notifier_.onEvent(ev); });
    registerFd(notifier_.getReadFD(), KUMA_EV_READ|KUMA_EV_ERROR, std::move(cb));
    return true;
}