diff options
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -52,6 +52,20 @@ static inline void mog_cancel_disable(void) assert(old == PTHREAD_CANCEL_ENABLE && "redundant cancel disable"); } +static inline void mog_testcancel(void) +{ + int old; + + mog_cancel_enable(); + + /* make sure we are already using the async cancel type */ + assert(0 == pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old) + && old == PTHREAD_CANCEL_ASYNCHRONOUS + && "asynchronous cancel not previously enabled"); + + mog_cancel_disable(); +} + /* compiler should optimize this away */ __attribute__((const)) static inline off_t off_t_max(void) { |