Changeset View
Changeset View
Standalone View
Standalone View
lib/Support/Unix/Process.inc
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | |||||
extern "C" struct term *set_curterm(struct term *termp); | extern "C" struct term *set_curterm(struct term *termp); | ||||
extern "C" int del_curterm(struct term *termp); | extern "C" int del_curterm(struct term *termp); | ||||
extern "C" int tigetnum(char *capname); | extern "C" int tigetnum(char *capname); | ||||
#endif | #endif | ||||
static bool terminalHasColors(int fd) { | static bool terminalHasColors(int fd) { | ||||
#ifdef HAVE_TERMINFO | #ifdef HAVE_TERMINFO | ||||
// First, acquire a global lock because these C routines are thread hostile. | // First, acquire a global lock because these C routines are thread hostile. | ||||
static sys::Mutex M; | static sys::RecursiveMutex M; | ||||
MutexGuard G(M); | MutexGuard G(M); | ||||
int errret = 0; | int errret = 0; | ||||
if (setupterm((char *)nullptr, fd, &errret) != 0) | if (setupterm((char *)nullptr, fd, &errret) != 0) | ||||
// Regardless of why, if we can't get terminfo, we shouldn't try to print | // Regardless of why, if we can't get terminfo, we shouldn't try to print | ||||
// colors. | // colors. | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |