+int init_epoll(int rcv_fd) {
+ struct epoll_event epe;
+ int epoll_fd = epoll_create1( 0 );
+ epe.events = EPOLLIN;
+ epe.data.fd = rcv_fd;
+ epoll_ctl( epoll_fd, EPOLL_CTL_ADD, rcv_fd, &epe );
+ return epoll_fd;
+}
+
+void close_epoll(int epoll_fd) {
+ if(epoll_fd >= 0) {
+ close(epoll_fd);
+ }
+}
+
+int wait_epoll(int epoll_fd,int rcv_fd) {
+ struct epoll_event events[1];
+ if( epoll_wait( epoll_fd, events, 1, -1 ) > 0 ) {
+ if( events[0].data.fd == rcv_fd ) {
+ return 1;
+ }
+ }
+ return 0;
+}
+