Topic: Is it guaranteed that a static Object is crated at startup time


Author: James Dennett <jdennett@acm.org>
Date: Thu, 9 May 2002 19:40:51 GMT
Raw View
Tzvetan Mikov wrote:
> "Hillel Y. Sims" <usenet@phatbasset.com> wrote in message
> news:a9HA8.122704$sI3.27259023@news02.optonline.net...
>
>>It's implementation-specific, really -- on the Compaq C++ compiler, for
>>example, this construct is properly synchronized and thread-safe. See your
>>compiler docs (or do some testing to be sure).
>
>
> What does the standard say about it (sadly, I don't own a copy) ?
> I also wonder how expensive it is to generate implicit synchronization for
> this. It seems to me that it would require creating a kernel synchronization
> object and keeping it for the duration of the program.

It certainly doesn't require going to the kernel to synchronise
between threads on most platforms.

>
> I am pretty sure that no Windows compiler does this, for example.

The C++ Standard says nothing about threads, and so makes
the behaviour of every program which uses them undefined,
though it may (and really ought to) be defined by an
implementation which supports multi-threading.

Support for threading is something under consideration for
a future version of the C++ standard.

--
James Dennett <jdennett@acm.org>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]