Switch std::call_once to llvm::call_once
Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 llvm-svn: 294202
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "llvm/Support/RWMutex.h"
|
||||
|
||||
// Project includes
|
||||
#include "llvm/Support/Threading.h"
|
||||
#include "lldb/Utility/Stream.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
@@ -191,10 +192,10 @@ protected:
|
||||
// touch ConstStrings is difficult. So we leak the pool instead.
|
||||
//----------------------------------------------------------------------
|
||||
static Pool &StringPool() {
|
||||
static std::once_flag g_pool_initialization_flag;
|
||||
static llvm::once_flag g_pool_initialization_flag;
|
||||
static Pool *g_string_pool = nullptr;
|
||||
|
||||
std::call_once(g_pool_initialization_flag,
|
||||
llvm::call_once(g_pool_initialization_flag,
|
||||
[]() { g_string_pool = new Pool(); });
|
||||
|
||||
return *g_string_pool;
|
||||
|
||||
Reference in New Issue
Block a user