diff options
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r-- | lldb/source/Target/Platform.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index f4c387ad691..97be08490e4 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -29,7 +29,9 @@ using namespace lldb; using namespace lldb_private; - + +static uint32_t g_initialize_count = 0; + // Use a singleton function for g_local_platform_sp to avoid init // constructors since LLDB is often part of a shared library static PlatformSP& @@ -76,6 +78,25 @@ GetPlatformListMutex () } void +Platform::Initialize () +{ + g_initialize_count++; +} + +void +Platform::Terminate () +{ + if (g_initialize_count > 0) + { + if (--g_initialize_count == 0) + { + Mutex::Locker locker(GetPlatformListMutex ()); + GetPlatformList().clear(); + } + } +} + +void Platform::SetHostPlatform (const lldb::PlatformSP &platform_sp) { // The native platform should use its static void Platform::Initialize() |