void EventScheduler::DisableReading(EventHandler& handle) { int waiting_event = handle.GetWaitingEvent(); if(waiting_event == EPOLLIN) { UninstallEvent(handle, kReadEvent); ModifyEvent(handle); } else { FILE_LOG(logERROR)<<"the handle already has been disabling reading"; } }
void EventScheduler::DisableWriting(EventHandler& handle) { int waiting_event = handle.GetWaitingEvent(); if(waiting_event == EPOLLOUT) { UninstallEvent(handle, kWriteEvent); ModifyEvent(handle); } else { FILE_LOG(logERROR)<<"the handle already has waiting to write"; } }
void EventScheduler::EnableReading(EventHandler& handle) { int waiting_event = handle.GetWaitingEvent(); if(0 == waiting_event) { FILE_LOG(logINFO)<<" enableread"; InstallEvent(handle, kReadEvent); AddEvent(handle); } else if(waiting_event != EPOLLIN) { InstallEvent(handle, kReadEvent); ModifyEvent(handle); } else { //LOG FILE_LOG(logERROR)<<"the handle already has waiting to read"; } }
void EventScheduler::UninstallEvent(EventHandler& handle, int event) { int waiting_event = handle.GetWaitingEvent(); waiting_event &= ~event; handle.SetWaitingEvent(waiting_event); }