From 7cab9e695d0cfd0e935a6ef100a914aa6f661cc4 Mon Sep 17 00:00:00 2001 From: weiyu Date: Wed, 9 Sep 2020 13:36:38 -0700 Subject: [PATCH] Add file --- epoll.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 epoll.cc diff --git a/epoll.cc b/epoll.cc new file mode 100644 index 00000000..2b4c206f --- /dev/null +++ b/epoll.cc @@ -0,0 +1,15 @@ +#include "threads-model.h" +#include +#include + +int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) { + while(timeout != 0) { + int res = real_epoll_wait(epfd, events, maxevents, 0); + if (res != 0) + return res; + usleep(1); + if (timeout > 0) + timeout--; + } + return 0; +} -- 2.34.1