PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.

Peter Rehley
Thu Jun 9 02:52:00 GMT 2005

On Jun 8, 2005, at 2:59 PM, Thomas E. Zerucha wrote:

> I have a problem similar to that of:
> I have an old system that I'm trying to port that uses pthreads, but 
> doesn't set the attribute, and a non-owner thread will destroy the 
> thread in a deallocate routine, but this won't happen (it won't 
> actually destroy the thread).
> The problem is that (in pthread.h) PTHREAD_MUTEX_DEFAULT is .._NORMAL 
> on linux, the system was originally written for.  It works but 
> eventually dies when it runs out of threads or mutexes or something 
> since it can't recycle.  PTHREAD_MUTEX_DEFAULT is .._ERRORCHECK on 
> cygwin.
> It would be painful to add a whole section to create an attribute 
> structure just to set this to be the same as linux.
If you look at the test case you will see a line that says

This causes the program to use the default (ERRORCHECK) mutex.  To get 
a normal mutex, you can use

However, in the test case when NORMAL is used, the mutex never gets 
unlocked because the signal SIG_CHLD doesn't get to the parent.

Hopefully that is something that you can use.
> I can't seem to build the cygwin1.dll so I could replace it (are there 
> any instructions on how to create an identical copy to the release?  I 
> didn't see any on the FAQ, and ./configure;make generates a file 8x 
> larger, and it complained about something with the address).
You need to provide more information than this.  Based on what you 
said, you didn't follow the instructions in the FAQ; and yes there are 
instructions for building the cygwin1.dll in the FAQ

> I think just changing it in the pthread.h and recompiling the dll will 
> fix it.  Note that the attribute is invisible since you need not 
> bother with the attr structure and parameter when doing defaults.
> --
> Unsubscribe info:
> Problem reports:
> Documentation:
> FAQ:         
A Møøse once bit my sister

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list