26 #ifdef CHSM_MULTITHREADED
30 #ifdef CHSM_MULTITHREADED
34 #define DEFER_CANCEL() \
35 { int pjl_cancel_type; \
36 ::pthread_setcanceltype( PTHREAD_CANCEL_DEFERRED, &pjl_cancel_type )
38 #define RESTORE_CANCEL() \
39 ::pthread_setcanceltype( pjl_cancel_type, 0 ); \
40 ::pthread_testcancel(); }
44 #define DEFER_CANCEL()
45 #define RESTORE_CANCEL()
49 #ifdef CHSM_MULTITHREADED
59 #define MUTEX_LOCK(M,D) { \
60 int pjl_cancel_type; bool const pjl_defer_cancel = (D); \
61 ::pthread_setcanceltype( PTHREAD_CANCEL_DEFERRED, &pjl_cancel_type ); \
62 pthread_cleanup_push( (void (*)(void*))::pthread_mutex_unlock, (M) ); \
63 ::pthread_mutex_lock( (M) ); \
65 ::pthread_setcanceltype( pjl_cancel_type, 0 ); \
66 ::pthread_testcancel(); \
69 #define MUTEX_UNLOCK() \
70 pthread_cleanup_pop( 1 ); \
71 if ( pjl_defer_cancel ) { \
72 ::pthread_setcanceltype( pjl_cancel_type, 0 ); \
73 ::pthread_testcancel(); \
79 #define MUTEX_LOCK(M,D)
80 #define MUTEX_UNLOCK()