pthread_mutex_trylock does not lock

Robert Collins rbcollins@cygwin.com
Tue Dec 3 03:11:00 GMT 2002


On Tue, 2002-12-03 at 20:37, Chris Knight wrote:
> Hello,
> 
> 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

-- 
---
GPG key available at: http://users.bigpond.net.au/robertc/keys.txt.
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://cygwin.com/pipermail/cygwin/attachments/20021203/c0c35556/attachment.sig>


More information about the Cygwin mailing list