This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: 1.3.12: pthread mutex - second lock won't block.
- From: Clemens Fuchslocher <clfuit00 at fht-esslingen dot de>
- To: Robert Collins <robert dot collins at syncretize dot net>, <cygwin at cygwin dot com>
- Date: Sun, 7 Jul 2002 18:46:30 +0200 (CEST)
- Subject: Re: 1.3.12: pthread mutex - second lock won't block.
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/