[Support] Fix a race initializing a static local in MSVC
authorReid Kleckner <reid@kleckner.net>
Thu, 11 Jun 2015 22:22:45 +0000 (22:22 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 11 Jun 2015 22:22:45 +0000 (22:22 +0000)
commit5e9819c5bdb37d90a7b3196ea77034e60d2609c3
tree967a5f971df34f0a76c26b3fed7c44f53866ba57
parent68e51493f776db7213094864f35d514e8bace5c1
[Support] Fix a race initializing a static local in MSVC

static local initialization isn't thread safe with MSVC and a race was
reported in PR23817. We can't use std::atomic because it's not trivially
constructible, so instead do some lame volatile global integer
manipulation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239566 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Windows/Memory.inc