mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +00:00
Converting terminalHasColors mutex to a global ManagedStatic to avoid the static destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218283 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b365159bf
commit
f1a19cd9fc
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user