delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/27/19:35:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Mime-Version: 1.0 (Apple Message framework v622)
In-Reply-To: <20050527202823.GB4939@trixie.casa.cgf.cx>
References: <44f83c19cc33e4382680fe3758164ccf AT rehley DOT net> <20050527202823 DOT GB4939 AT trixie DOT casa DOT cgf DOT cx>
Message-Id: <0833be552ca5aa00a72ecef822250580@rehley.net>
From: Peter Rehley <peter AT rehley DOT net>
Subject: Re: pthreads, cygwin and pthread_mutex_lock not blocking
Date: Fri, 27 May 2005 16:35:39 -0700
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j4RNZo91006408

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.

The application that I'm working on is rpm 4.3.3, the problem that we 
are seeing is running scripts.  When set the default is set to 
ERRORCHECK, the parent process doesn't wait and removes the script 
before the child has chance to run it.

When default is NORMAL, the parents hangs waiting for the child.  The 
app uses SIGCHLD to signal the parent when the child dies, and the 
signal handler for sigchld releases the mutex.  This should cause the 
WaitForSingleObject to release and the application should continue to 
run.  For whatever reason, the signal isn't being seen by the parent.

Enjoy,
Peter
-------------------------------
A Møøse once bit my sister


--
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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019