 |
|
|
|
Actions
|
|
[ Date Prev][ Date Next][ Thread Prev][ Thread Next][ Date Index][ Thread Index]
Re: [c++-pthreads] Initialization of local static mutex
- To: Roland Schwarz <roland.schwarz@xxxxxxxxx>
- Subject: Re: [c++-pthreads] Initialization of local static mutex
- From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
- Date: Sun, 08 Oct 2006 10:00:49 -0700
Roland Schwarz wrote:
Mark Mitchell wrote:
PTHREAD_MUTEX_INITIALIZER is supposed to be a constant-expression
(like "-1" or "{ 1, 0 }"), so the initialization will happen before
foo is called, typically at program start-up.
This was not my question, or concern. I am not asking what is typical,
but if it is possible that a standard conforming compiler can suffer
from such a race condition.
A standard-conforming compiler, used with a standard-conforming POSIX
library, cannot suffer from a race condition in the code that you posted
because PTHREAD_MUTEX_INITIALIZER must be a constant-expression.
--
Mark Mitchell
CodeSourcery
mark@xxxxxxxxxxxxxxxx
(650) 331-3385 x713
|
|