pthread_mutex_trylock does not lock

Robert Collins rbcollins@cygwin.com
Tue Dec 3 04:14:00 GMT 2002


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.

-------------- 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/03333027/attachment.sig>


More information about the Cygwin mailing list