projects
/
c11tester.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
542a461
)
Add file
author
weiyu
<weiyuluo1232@gmail.com>
Wed, 9 Sep 2020 20:36:38 +0000
(13:36 -0700)
committer
weiyu
<weiyuluo1232@gmail.com>
Wed, 9 Sep 2020 20:36:38 +0000
(13:36 -0700)
epoll.cc
[new file with mode: 0644]
patch
|
blob
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;
+}