thread-safe local static variable initialization

Jonathan Schilling jls at sco.com
Mon Jun 7 19:16:00 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.)

Jonathan Schilling		SCO, Inc.		jls at sco.com




More information about the cxx-abi-dev mailing list