From 8556456790cc823243ae05435af07dc1bc5b2f2e Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 11 Jun 2005 04:56:36 +0000 Subject: * include/pthread.h: Change PTHREAD_MUTEX_DEFAULT to PTHREAD_MUTEX_NORMAL. Revert PTHREAD_MUTEX_INITIALIZER to PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP since that is actually closer to what linux does. * thread.h (cw_cancel_action): New enum. (cancelable_wait): Use cw_cancel_action as third argument. * thread.cc (cancelable_wait): Ditto. Don't wait for cancel if cancel_action == cw_no_cancel. (pthread::create): Don't wait for cancel event since that is racy. (pthread_mutex::pthread_mutex): Set default to PTHREAD_MUTEX_ERRORCHECK. (pthread_mutexattr::pthread_mutexattr): Ditto. (pthread_mutex::_lock): Tell cancelable_wait not to wait for cancellation event. (semaphore::_timedwait): Accommodate change in cancelable_wait args. (pthread::join): Ditto. --- winsup/cygwin/thread.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/thread.h') diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 6cce1fa4a..5f7b39845 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -31,6 +31,13 @@ enum cw_sig_wait cw_sig_resume }; +enum cw_cancel_action +{ + cw_cancel_self, + cw_no_cancel_self, + cw_no_cancel +}; + extern "C" { void SetResourceLock (int, int, const char *) __attribute__ ((regparm (3))); @@ -38,7 +45,7 @@ void ReleaseResourceLock (int, int, const char *) __attribute__ ((regparm (3))); } -DWORD cancelable_wait (HANDLE, DWORD, const bool = true, const enum cw_sig_wait = cw_sig_nosig) +DWORD cancelable_wait (HANDLE, DWORD, const cw_cancel_action = cw_cancel_self, const enum cw_sig_wait = cw_sig_nosig) __attribute__ ((regparm (3))); class fast_mutex @@ -70,7 +77,7 @@ public: void lock () { if (InterlockedIncrement ((long *) &lock_counter) != 1) - cancelable_wait (win32_obj_id, INFINITE, false, cw_sig_resume); + cancelable_wait (win32_obj_id, INFINITE, cw_no_cancel, cw_sig_resume); } void unlock () -- cgit v1.2.3