diff options
author | Chris Bieneman <beanz@apple.com> | 2014-09-22 22:39:20 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2014-09-22 22:39:20 +0000 |
commit | fa35e11a7badb4a5994cb5330df42b649e3eb828 (patch) | |
tree | db084435fbbd85fa0e632c3f33921917dada70c3 /llvm/lib/Support/Unix/Process.inc | |
parent | ed5dfff865c2ec5593fc091c4fef9489a21b98c6 (diff) | |
download | bcm5719-llvm-fa35e11a7badb4a5994cb5330df42b649e3eb828.tar.gz bcm5719-llvm-fa35e11a7badb4a5994cb5330df42b649e3eb828.zip |
Converting terminalHasColors mutex to a global ManagedStatic to avoid the static destructor.
llvm-svn: 218283
Diffstat (limited to 'llvm/lib/Support/Unix/Process.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Process.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc index d2c5dbcf6eb..566684ff5eb 100644 --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -14,6 +14,7 @@ #include "Unix.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Mutex.h" #include "llvm/Support/MutexGuard.h" #include "llvm/Support/TimeValue.h" @@ -263,11 +264,12 @@ extern "C" int del_curterm(struct term *termp); extern "C" int tigetnum(char *capname); #endif +static ManagedStatic<sys::Mutex> TermColorMutex; + static bool terminalHasColors(int fd) { #ifdef HAVE_TERMINFO // First, acquire a global lock because these C routines are thread hostile. - static sys::Mutex M; - MutexGuard G(M); + MutexGuard G(*TermColorMutex); int errret = 0; if (setupterm((char *)nullptr, fd, &errret) != 0) |