pthreads, cygwin and pthread_mutex_lock not blocking

Peter Rehley peter@rehley.net
Tue May 31 18:09:00 GMT 2005


Well, here is a simple test case, but turns out I wasn't using the 
latest version.  I was having the problem on 1.5.12,  I haven't been 
able to get a good build with cygwin 1.5.17-1.  It builds and I can run 
the install script, but when I put the dll in place I see the message 
"cygheap magic number mismatch detected", and gcc doesn't want to work.

I followed the instructions on the FAQ page for building cygwin.  Also 
the only line that I changed was in winsup/cygwin/include/pthread.h, 
line 56

from
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_ERRORCHECK
to
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL

On the unmodified cygwin 1.5.17, the parent lock returns 45 (EDEADLK)

On May 28, 2005, at 9:15 AM, Christopher Faylor wrote:

> On Fri, May 27, 2005 at 04:35:39PM -0700, Peter Rehley wrote:
>> On May 27, 2005, at 1:28 PM, Christopher Faylor wrote:
>>
>>> On Fri, May 27, 2005 at 10:57:34AM -0700, Peter Rehley wrote:
>>>> I'm trying to use pthread in cygwin, and I'm expecting the function
>>>> pthread_mutex_lock to block when used.  However it is returning 
>>>> error
>>>> 45 (EDEADLK).    I'm using a static initializer for the thread so 
>>>> the
>>>> mutex is type PTHREAD_MUTEX_DEFAULT.
>>>> When I look through the pthread code I see that 
>>>> PTHREAD_MUTEX_DEFAULT
>>>> is set to PTHREAD_MUTEX_ERRORCHECK,
>>>> When I do the same on linux or soloris, the pthread_mutex_lock 
>>>> blocks,
>>>> and looking in the pthread.h file on those systems see that  the
>>>> default is set to PTHREAD_MUTEX_NORMAL.
>>>>
>>>> Why is cygwin using PTHREAD_MUTEX_ERRORCHECK as the default?  And 
>>>> what
>>>> problems might occur if PTHREAD_MUTEX_DEFAULT is set to
>>>> PTHREAD_MUTEX_NORMAL?
>>>
>>> Why not just try it and report the results?
>> Done.  Hangs at WaitForSingleObject.
>
> Can you provide a STC(tm) (simple test case) which demonstrates the
> problem both with and without PTHREAD_MUTEX_ERRORCHECK?
>
> cgf
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>
>
>
Enjoy,
Peter
-------------------------------
A Møøse once bit my sister
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fork_test.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050531/cd331ad1/attachment.c>
-------------- next part --------------


-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list