2 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
3 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
5 #if defined(HAVE_KQUEUE)
6 # define MOG_SELFPIPE 1
7 #elif (defined(HAVE_EPOLL_WAIT) && defined(HAVE_PPOLL)) \
8 || defined(HAVE_EPOLL_PWAIT)
9 # define MOG_SELFPIPE 0
11 # define MOG_SELFPIPE 1
15 struct mog_queue
*queue
;
16 struct mog_fd
*writer
;
21 struct mog_fd
*reader
; /* points to mog_selfwake */
25 struct mog_fd
* mog_selfwake_new(void);
26 void mog_selfwake_trigger(struct mog_fd
*);
27 void mog_selfwake_drain(struct mog_fd
*);
28 #define mog_selfwake_put(mfd) mog_fd_put((mfd))
29 static inline void mog_selfwake_interrupt(void) {}
30 void mog_selfwake_wait(struct mog_fd
*);
31 #else /* use Linux-only facilities like epoll_pwait or ppoll */
32 static inline void mog_selfwake_wait(struct mog_fd
*mfd
)
36 static inline struct mog_fd
* mog_selfwake_new(void) { return NULL
; }
37 static inline void mog_selfwake_trigger(struct mog_fd
*mfd
) {}
38 static inline void mog_selfwake_drain(struct mog_fd
*mfd
) {}
39 static inline void mog_selfwake_put(struct mog_fd
*mfd
) {}
40 static inline void mog_selfwake_interrupt(void)
42 CHECK(int, 0, kill(getpid(), SIGURG
));
44 #endif /* Linux-only stuff */