OSDN Git Service

This is yet another attempt to re-instate r220932 as discussed in
authorChandler Carruth <chandlerc@gmail.com>
Thu, 2 Jun 2016 18:22:12 +0000 (18:22 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 2 Jun 2016 18:22:12 +0000 (18:22 +0000)
commit8290382d1f108e03494669ea65f62ce37546646d
tree82f3097ffafd03f9812e68f6bf029e904530dc9d
parent698e829b29afb2cba6f27775eaad5e71311b5704
This is yet another attempt to re-instate r220932 as discussed in
D19271.

Previous attempt was broken by NetBSD, so in this version I've made the
fallback path generic rather than Windows specific and sent both Windows
and NetBSD to it.

I've also re-formatted the code some, and used an exact clone of the
code in PassSupport.h for doing manual call-once using our atomics
rather than rolling a new one.

If this sticks, we can replace the fallback path for Windows with
a Windows-specific implementation that is more reliable.

Original commit message:
This patch adds an llvm_call_once which is a wrapper around
std::call_once on platforms where it is available and devoid
of bugs. The patch also migrates the ManagedStatic mutex to
be allocated using llvm_call_once.

These changes are philosophically equivalent to the changes
added in r219638, which were reverted due to a hang on Win32
which was the result of a bug in the Windows implementation
of std::call_once.

Differential Revision: http://reviews.llvm.org/D5922

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271558 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Threading.h
lib/Support/ManagedStatic.cpp
lib/Support/Threading.cpp