frsyuki (owner)

Revisions

gist: 198775 Download_button fork
public
Public Clone URL: git://gist.github.com/198775.git
Embed All Files: show embed
Diff #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 {