From: Martin Willi Date: Wed, 5 Nov 2014 18:30:45 +0000 (+0100) Subject: thread: Test for pending cancellation requests before poll()ing on OS X X-Git-Tag: 5.2.2dr1~34^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78725e68c1934742123fef647046078307e2bbc8;p=thirdparty%2Fstrongswan.git thread: Test for pending cancellation requests before poll()ing on OS X As we are now using poll(2) instead of select(2), we need the work-around from 76dc329e for poll() as well. --- diff --git a/src/libstrongswan/threading/thread.h b/src/libstrongswan/threading/thread.h index 6abb834110..c6342321b6 100644 --- a/src/libstrongswan/threading/thread.h +++ b/src/libstrongswan/threading/thread.h @@ -215,6 +215,26 @@ static inline int precancellable_select(int nfds, fd_set *restrict readfds, } #define select precancellable_select +#include + +/* + * The same as to select(2) applies to poll(2) + */ +static inline int precancellable_poll(struct pollfd fds[], nfds_t nfds, + int timeout) +{ + if (thread_cancelability(TRUE)) + { + thread_cancellation_point(); + } + else + { + thread_cancelability(FALSE); + } + return poll(fds, nfds, timeout); +} +#define poll precancellable_poll + #endif /* __APPLE__ */ #endif /** THREADING_THREAD_H_ @} */