Re: PTHREAD_MUTEX_INITIALIZER
- From: Alexander Terekhov <terekhov@xxxxxx>
- Date: Mon, 23 Jun 2008 23:18:21 +0200
Hallvard B Furuseth wrote:
[...]
Must it be a bug?
No. :-)
"In cases where default mutex attributes are appropriate, the macro
PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes that are
statically allocated. The effect shall be equivalent to dynamic
initialization by a call to pthread_mutex_init() with parameter attr
specified as NULL, except that no error checks are performed." The thing
is that many programs using PTHREAD_MUTEX_INITIALIZER may well exhibit
undefined behaviour without any application's bugs under the current
wording. It would be helpful if the standard would make it clear that
*initial* call to pthread_mutex_lock() for a PTHREAD_MUTEX_INITIALIZER'd
mutex shall fail for all the same reasons as pthread_mutex_init() (in
addition to the current pthread_mutex_lock() "shall fail" failure
modes)...
regards,
alexander.
.
- Follow-Ups:
- Re: PTHREAD_MUTEX_INITIALIZER
- From: David Schwartz
- Re: PTHREAD_MUTEX_INITIALIZER
- References:
- Re: PTHREAD_MUTEX_INITIALIZER
- From: Anthony Williams
- Re: PTHREAD_MUTEX_INITIALIZER
- From: David Schwartz
- Re: PTHREAD_MUTEX_INITIALIZER
- From: Anthony Williams
- Re: PTHREAD_MUTEX_INITIALIZER
- From: David Schwartz
- Re: PTHREAD_MUTEX_INITIALIZER
- From: Dave Butenhof
- Re: PTHREAD_MUTEX_INITIALIZER
- From: David Schwartz
- Re: PTHREAD_MUTEX_INITIALIZER
- From: Chris Friesen
- Re: PTHREAD_MUTEX_INITIALIZER
- From: Hallvard B Furuseth
- Re: PTHREAD_MUTEX_INITIALIZER
- Prev by Date: Re: PTHREAD_MUTEX_INITIALIZER
- Next by Date: Re: PTHREAD_MUTEX_INITIALIZER
- Previous by thread: Re: PTHREAD_MUTEX_INITIALIZER
- Next by thread: Re: PTHREAD_MUTEX_INITIALIZER
- Index(es):
Relevant Pages
|