[PATCH] default to normal pthread mutexes

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 14 09:45:00 GMT 2014


Hi Yaakov,

On Jul 13 18:38, Yaakov Selkowitz wrote:
> Defaulting to ERRORCHECK mutexes (with the various stringencies it implies)
> does not match the behaviour on Linux, where NORMAL mutexes are the default.
> I have been testing this locally for some time, and I believe it affects a
> lot of software.  Patch and STC attached.
> 
> 
> Yaakov

> 2014-07-13  Yaakov Selkowitz  <yselkowitz@...>
> 
> 	* thread.cc (pthread_mutex::pthread_mutex): Change default type
> 	to PTHREAD_MUTEX_NORMAL.
> 	(pthread_mutexattr::pthread_mutexattr): Ditto.
> 	(pthread_mutex_unlock): Do not fail if mutex is a normal mutex
> 	initializer.
> 	* include/pthread.h (PTHREAD_MUTEX_INITIALIZER): Redefine as
> 	PTHREAD_NORMAL_MUTEX_INITIALIZER_NP.

I checked this in with a small addition.  While testing I found that
Cygwin's pthread_mutex_unlock returned EINVAL if the mutex is of the
PTHREAD_MUTEX_ERRORCHECK type and the mutex wasn't owned by any thread
(as in your STC),  Linux returns EPERM in this case.  I fixed that.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20140714/c2375aac/attachment.sig>


More information about the Cygwin-patches mailing list