Lines Matching refs:loop
21 static int IsValid_(const EventEpoll *loop) in IsValid_() argument
23 return loop->epollFd >= 0; in IsValid_()
37 static LE_STATUS Close_(const EventLoop *loop) in Close_() argument
39 LE_CHECK(loop != NULL, return LE_FAILURE, "Invalid loop"); in Close_()
40 EventEpoll *epoll = (EventEpoll *)loop; in Close_()
47 static LE_STATUS AddEvent_(const EventLoop *loop, const BaseTask *task, int op) in AddEvent_() argument
50 LE_CHECK(loop != NULL, return LE_FAILURE, "Invalid loop"); in AddEvent_()
51 EventEpoll *epoll = (EventEpoll *)loop; in AddEvent_()
63 static LE_STATUS ModEvent_(const EventLoop *loop, const BaseTask *task, int op) in ModEvent_() argument
66 LE_CHECK(loop != NULL, return LE_FAILURE, "Invalid loop"); in ModEvent_()
67 EventEpoll *epoll = (EventEpoll *)loop; in ModEvent_()
79 static LE_STATUS DelEvent_(const EventLoop *loop, int fd, int op) in DelEvent_() argument
81 LE_CHECK(loop != NULL, return LE_FAILURE, "Invalid loop"); in DelEvent_()
82 EventEpoll *epoll = (EventEpoll *)loop; in DelEvent_()
92 static LE_STATUS RunLoop_(const EventLoop *loop) in RunLoop_() argument
94 LE_CHECK(loop != NULL, return LE_FAILURE, "Invalid loop"); in RunLoop_()
95 EventEpoll *epoll = (EventEpoll *)loop; in RunLoop_()
100 LE_RunIdle((LoopHandle)&(epoll->loop)); in RunLoop_()
102 int number = epoll_wait(epoll->epollFd, epoll->waitEvents, loop->maxevents, -1); in RunLoop_()
105 ProcessEvent(loop, epoll->waitEvents[index].data.fd, Event_Read); in RunLoop_()
108 ProcessEvent(loop, epoll->waitEvents[index].data.fd, Event_Write); in RunLoop_()
112 ProcessEvent(loop, epoll->waitEvents[index].data.fd, Event_Error); in RunLoop_()
116 ProcessEvent(loop, epoll->waitEvents[index].data.fd, Event_Error); in RunLoop_()
119 if (loop->stop) { in RunLoop_()
126 LE_STATUS CreateEpollLoop(EventLoop **loop, uint32_t maxevents, uint32_t timeout) in CreateEpollLoop() argument
128 LE_CHECK(loop != NULL, return LE_FAILURE, "Invalid loop"); in CreateEpollLoop()
135 *loop = (EventLoop *)epoll; in CreateEpollLoop()
136 epoll->loop.maxevents = maxevents; in CreateEpollLoop()
137 epoll->loop.timeout = timeout; in CreateEpollLoop()
138 epoll->loop.close = Close_; in CreateEpollLoop()
139 epoll->loop.runLoop = RunLoop_; in CreateEpollLoop()
140 epoll->loop.delEvent = DelEvent_; in CreateEpollLoop()
141 epoll->loop.addEvent = AddEvent_; in CreateEpollLoop()
142 epoll->loop.modEvent = ModEvent_; in CreateEpollLoop()