1.3.12: pthread mutex - second lock won't block.

Clemens Fuchslocher clfuit00@fht-esslingen.de
Sun Jul 7 09:55:00 GMT 2002


On Sun, 7 Jul 2002, Robert Collins wrote:

> Cygwin's default pthread mutex type is RECURSIVE. And the pthread
> mutex attribute calls will reject any 'normal' or 'errorchecking'
> mutex type requests. It's fully in the pthread spec is this regard.

So I can only use the PTHREAD_MUTEX_RECURSIVE type under cygwin?

I have test it with the following source fragment. And it will
cause a 'pthread_mutexattr_settype: Invalid argument' message.
Only PTHREAD_MUTEX_RECURSIVE will work.

Oops, ok. :)

-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=
[...]
pthread_mutexattr_t attr;

if ((ret = pthread_mutexattr_init (&attr)) != 0)
{
   printf ("pthread_mutexattr_init: %s\n", strerror (ret));
   return EXIT_FAILURE;
}

if ((ret = pthread_mutexattr_settype (&attr,
        PTHREAD_MUTEX_NORMAL)) != 0)
{
   printf ("pthread_mutexattr_settype: %s\n", strerror (ret));
   return EXIT_FAILURE;
}
[...]
-=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-= -=-=

> If your application is assuming that the default mutex type is
> non recursive, it is a bug in your code.

Yes, I have assumed that.

Thank you!
-- 
:)



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list