PTHREAD_MUTEX_DEFAULT different for cygwin v.s. linux.
Thu Jun 9 16:07:00 GMT 2005
On Wed, Jun 08, 2005 at 03:29:46PM -0700, Peter Rehley wrote:
>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
>>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 mutex=PTHREAD_NORMAL_MUTEX_INITIALIZER_NP;
>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.
FWIW, I've changed the default for PTHREAD_MUTEX_INITIALIZER to
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP in CVS. Last night I also tried to
implement handling for interrupting mutexes based on Corinna's
explanation of what your patch did.
Both of these changes are in the current snapshot.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin