thread-safe local static variable initialization

Mike Ball michael.ball at eng.sun.com
Mon Jun 7 21:36:05 UTC 1999


>Another issue to add to the C++ ABI "Miscellaneous" list is local static 
>variables with dynamic initialization expressions, when multiple threads 
>are possible.  The first thread through has to block other threads from
>accessing the variable until initialization is complete.  For some 
>compilers at least, the generated code tests flags and calls a runtime 
>support routine that waits on the flags changing state.  Thus, this can 
>be an ABI issue.
>
>(I mentioned this during last week's meeting, and Mike Ball said
>something to the effect that this was already fully described by
>the language.  But given that the language says nothing about
>multithreading to begin with, I'm not sure what he meant.)

As far as I can tell, the language says that the automatic blocking
issue isn't a valid approach.  It says what has to happen, and
it isn't that.

-Mike-





More information about the cxx-abi-dev mailing list