Add file
[c11tester.git] / epoll.cc
diff --git a/epoll.cc b/epoll.cc
new file mode 100644 (file)
index 0000000..2b4c206
--- /dev/null
+++ b/epoll.cc
@@ -0,0 +1,15 @@
+#include "threads-model.h"
+#include <sys/epoll.h>
+#include <unistd.h>
+
+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;
+}