Fixed a crasher where during shutdown, loggings attempted to access the

thread name but the static map instance had already been destructed.

rdar://problem/8153284

llvm-svn: 111812
This commit is contained in:
Johnny Chen 2010-08-23 17:13:12 +00:00
parent d0190a6182
commit a73af6f698
1 changed files with 7 additions and 1 deletions

View File

@ -325,7 +325,13 @@ ThreadNameAccessor (bool get, lldb::pid_t pid, lldb::tid_t tid, const char *name
Mutex::Locker locker(&g_mutex);
typedef std::map<uint64_t, std::string> thread_name_map;
static thread_name_map g_thread_names;
// rdar://problem/8153284
// Fixed a crasher where during shutdown, loggings attempted to access the
// thread name but the static map instance had already been destructed.
// Another approach is to introduce a static guard object which monitors its
// own destruction and raises a flag, but this incurs more overhead.
static thread_name_map *g_thread_names_ptr = new thread_name_map();
thread_name_map &g_thread_names = *g_thread_names_ptr;
if (get)
{