This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: private static instance construction not thread-safe?


On Wed, Jul 31, 2002 at 10:48:15AM -0400, Joe Buehler wrote:
>The attached C++ generates code that is not thread-safe,
>when using the gcc 2.95 prebuilt for Cygwin and installable
>via the Cygwin installer.
>
>gcc inserts code at the top of f() to take care of construction
>of the "temp" instance, and to schedule its destruction at program
>exit time, using atexit().
>
>The code that does this is not thread-safe -- two calls to f()
>around the same time can cause double-construction, double
>calls to atexit(), etc.
>
>Is this a gcc bug, or a result of the way that the gcc I am using
>has been configured?  Or is some gcc option supposed to be used
>that will take care of this?
>
>My apologies if this has been asked a million times -- I did not
>find anything in GNATS for gcc.

The non-test versions cygwin gcc 2.95 were not built with thread support
enabled.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]