delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/03/06:11:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Subject: Re: pthread_mutex_trylock does not lock
From: Robert Collins <rbcollins AT cygwin DOT com>
To: Chris Knight <c DOT knight AT teligent DOT co DOT uk>
Cc: cygwin AT cygwin DOT com
In-Reply-To: <IGEKLLNAJDPOMLJGIFBIAECHCCAA.c.knight@teligent.co.uk>
References: <IGEKLLNAJDPOMLJGIFBIAECHCCAA DOT c DOT knight AT teligent DOT co DOT uk>
Date: 03 Dec 2002 22:11:32 +1100
Message-Id: <1038913892.10594.35.camel@lifelesswks>
Mime-Version: 1.0

--=-Ab6A2nz5kxNN1Us5EVwE
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2002-12-03 at 20:37, Chris Knight wrote:
> Hello,
>=20
> I think I have found a problem in the "pthread_mutex_trylock" call.  When=
 I
> run the following code both the trylock and lock return immediately.  If =
I
> compile this under RedHat 8 it works as I would expect with the trylock
> locking the mutex and the lock stopping execution.

Your code is buggy. You are assuming that the default mutex type is
nonrecursive, which is not the case in the version of cygwin you are
using.

If you *need* nonrecursive mutex's, you need to set that type in your
mutexattr struct.

Rob

--=20
---
GPG key available at: http://users.bigpond.net.au/robertc/keys.txt.
---

--=-Ab6A2nz5kxNN1Us5EVwE
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA97JFkI5+kQ8LJcoIRAtYeAKCO66wsy4XAe1CLsIoLrjLvsdQtXQCgxeyc
pqvHJNCxTXSkBLNG3du2ixM=
=Io/l
-----END PGP SIGNATURE-----

--=-Ab6A2nz5kxNN1Us5EVwE--

- Raw text -


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