[llvm-commits] [llvm] r76910 - in /llvm/trunk: include/llvm/Support/FormattedStream.h lib/Support/FormattedStream.cpp

Chris Lattner clattner at apple.com
Tue Jul 28 11:44:58 PDT 2009


On Jul 28, 2009, at 9:52 AM, David A. Greene wrote:

>>> +  // Keep a buffer of spaces handy to speed up processing.
>>> +  static char Spaces[MAX_COLUMN_PAD];
>>> +  static bool Initialized = false;
>>> +  if (!Initialized) {
>>
>> This won't work because it isn't thread safe.  Why not just use:
>
> Why isn't it thread safe?  Multiple threads might enter the then- 
> clause

You're assuming a lot about the implementation of std::fill_n and the  
memory ordering properties of various CPUs.  Please just don't go there.

-Chris



More information about the llvm-commits mailing list