This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: pthread_mutex_trylock does not lock


On Thu, 2002-12-05 at 08:33, Christophe Galerne wrote:


> This
> www.opengroup.org/onlinepubs/7908799/xsh/pthread_mutexattr_settype.html
> seems to explain that a PT_MUTEX_NORMAL mutex should behave the way Chris
> expect.

NB: PT_MUTEX_NORMAL is not a posix mutex type - it's
PTHREAD_MUTEX_NORMAL.... And yes, 'NORMAL' mutexs deadlock on relocking
attempts.

Thomas Pfaff is currently updating the cygwin mutex support - it would
be great to get some user feedback on his patches, and they support
PTHREAD_MUTEX_NORMAL mutex's.

>  > We don't support NONRECURSIVE mutex's. I don't know what you mean by
>  > NORECURSIVE threads.
> 
> Then maybe one should add a comment above
> pthread.h(55): #define PTHREAD_MUTEX_NORMAL 2
> that this option is not supported.

Or you could check the return value from pthread_mutexattr_settype and
see that it returns EINVAL.

> Also above
> pthread.h(57): #define PTHREAD_MUTEX_INITIALIZER (void *)20
> a comment that says that a default MUTEX will be recursive
> might avoid some surprise. =:-D

Look at pthread.h:53 and pthread.h:58. DEFAULT is mapped to RECURSIVE as
per the 1003.1 options 'an implementation may map this mutex to one of
the other mutex types'. Thus my initial comment: ASSUMING that
PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL is broken code. 

Rob


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

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]