Subject: RE: pthread_mutex_trylock does not lock
From: Robert Collins <[email-masked]>
To: Chris Knight <[email-masked]>
Cc: [email-masked]
Date: 03 Dec 2002 23:14:20 +1100

On Tue, 2002-12-03 at 23:06, Chris Knight wrote:
> Hello Rob,
> 
> I have changed the code, see below.  I now set the type to
> PTHREAD_MUTEX_NORMAL but that also does not block.  The only documentation
> on cygwin threads say this is the same as PTHREAD_MUTEX_FAST_NP 

What documentation says that?

The PTHREAD_MUTEX_FAST_NP under linux is NP -> NON PORTABLE. In other
words, expect it to break on all other platforms.

> which I know
> blocks under Linux.  Linux man pages also say that this is the default mutex
> type.
> 
> Do you know the right type for NONRECURSIVE threads.

We don't support NONRECURSIVE mutex's. I don't know what you mean by
NORECURSIVE threads.

If you need a portable way to do single entrancy within a single thread
and across threads, you are best to use a semaphore, not a mutex.

Cheers,
Rob

PS I've copied the list, so the solution is in the archives.