4 #define L1_CACHE_LINE_MAX 128 /* largest I've seen (Pentium 4) */
5 size_t rb_sp_l1_cache_line_size
;
7 #ifdef HAVE_SYS_EVENT_H
8 void sleepy_penguin_init_kqueue(void);
10 # define sleepy_penguin_init_kqueue() for(;0;)
13 #ifdef HAVE_SYS_EPOLL_H
14 void sleepy_penguin_init_epoll(void);
16 # define sleepy_penguin_init_epoll() for(;0;)
19 #ifdef HAVE_SYS_TIMERFD_H
20 void sleepy_penguin_init_timerfd(void);
22 # define sleepy_penguin_init_timerfd() for(;0;)
25 #ifdef HAVE_SYS_EVENTFD_H
26 void sleepy_penguin_init_eventfd(void);
28 # define sleepy_penguin_init_eventfd() for(;0;)
31 #ifdef HAVE_SYS_INOTIFY_H
32 void sleepy_penguin_init_inotify(void);
34 # define sleepy_penguin_init_inotify() for(;0;)
37 #ifdef HAVE_SYS_SIGNALFD_H
38 void sleepy_penguin_init_signalfd(void);
40 # define sleepy_penguin_init_signalfd() for(;0;)
43 static size_t l1_cache_line_size_detect(void)
45 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
46 long tmp
= sysconf(_SC_LEVEL1_DCACHE_LINESIZE
);
48 if (tmp
> 0 && tmp
<= L1_CACHE_LINE_MAX
)
50 #endif /* _SC_LEVEL1_DCACHE_LINESIZE */
51 return L1_CACHE_LINE_MAX
;
54 void Init_sleepy_penguin_ext(void)
56 rb_sp_l1_cache_line_size
= l1_cache_line_size_detect();
58 sleepy_penguin_init_kqueue();
59 sleepy_penguin_init_epoll();
60 sleepy_penguin_init_timerfd();
61 sleepy_penguin_init_eventfd();
62 sleepy_penguin_init_inotify();
63 sleepy_penguin_init_signalfd();