Created
October 1, 2009 07:13
-
-
Save frsyuki/198775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/mpsrc/wavy_port_epoll.h b/src/mpsrc/wavy_port_epoll.h | |
index 2000a6c..19dc4d4 100644 | |
--- a/src/mpsrc/wavy_port_epoll.h | |
+++ b/src/mpsrc/wavy_port_epoll.h | |
@@ -29,7 +29,9 @@ | |
#include <sys/time.h> | |
#include <sys/epoll.h> | |
#include <sys/resource.h> | |
+#ifndef NO_TIMERFD | |
#include <sys/timerfd.h> | |
+#endif | |
// work around for glibc header signalfd.h error:expected initializer before ‘throw | |
#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 8) | |
@@ -96,6 +98,32 @@ public: | |
} | |
+#ifdef NO_TIMERFD | |
+ struct timer { | |
+ public: | |
+ timer() : fd(-1) { } | |
+ ~timer() { if(fd >= 0) ::close(fd); } | |
+ private: | |
+ int fd; | |
+ friend class port; | |
+ timer(const timer&); | |
+ }; | |
+ int create_timer(timer* tm, const timespec* value, const timespec* interval) | |
+ { | |
+ int pair[2]; | |
+ pipe(pair); | |
+ close(pair[1]); | |
+ return pair[0]; | |
+ } | |
+ int add_timer(timer* tm) | |
+ { | |
+ return 0; | |
+ } | |
+ static int get_timer(event e) | |
+ { | |
+ return 0; | |
+ } | |
+#else | |
struct timer { | |
public: | |
timer() : fd(-1) { } | |
@@ -149,6 +177,7 @@ public: | |
} | |
return exp & 0x7fffffff; | |
} | |
+#endif | |
struct signal { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment