This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: threadsafeness at egcs1.0.3 and 1.1
- To: drepper at cygnus dot com (Ulrich Drepper)
- Subject: Re: threadsafeness at egcs1.0.3 and 1.1
- From: n dot lee at math dot auckland dot ac dot nz (Nicholas Lee)
- Date: Mon, 13 Jul 1998 10:09:17 GMT
- Cc: egcs at cygnus dot com
- Organization: Mathematics Department, University of Auckland
- References: <2353046752.900001211@DUCAT.INI.CMU.EDU>, <199807102001.WAA01324.cygnus.egcs@mira.isdn.cs.tu-berlin.de> <r2r9ztgjdw.fsf@happy.cygnus.com>
On 10 Jul 1998 20:24:11 -0700, you wrote:
>martin@mira.isdn.cs.tu-berlin.de (Martin von Loewis) writes:
>
>> int f()
>> {
>> static int i = get_some_value();
>> return i;
>> }
>>
>> If two threads call f concurrently, initialization might be performed
>> twice. Since this can be handled on the application level in many
>> cases, it is not considered a serious problem (by some).
>
[...]
>I see this case as a real boundary case which probably shouldn't
>handled at all and the use of non-const initializing of static
>variables should be outlawed.
Have you read Meyer's comment in MEC++, about function static vs class
static? (pg 133-134)
His basic comment is that function statics have value in that they nail
down the point of initialisation a some function call time.
Nicholas
--
"I reserve the right to contradict myself"
n.lee with math.auckland.ac in nz
NO commercial email please! No SPAM for me.