mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 19:13:22 +08:00
[0.2.x] ~thread-safe initialization of symbol cache
git-svn-id: https://pykd.svn.codeplex.com/svn@83129 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
a17d1a14f5
commit
7b1379d62e
@ -7,6 +7,8 @@
|
||||
#include "dbgengine.h"
|
||||
#include "symsessioncache.h"
|
||||
|
||||
#include <boost\thread\once.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace pykd {
|
||||
@ -149,11 +151,18 @@ DEBUG_CALLBACK_RESULT Impl::OnModuleUnload( ULONG64 modBase, const std::string &
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// construct after DebugEngine
|
||||
Impl *g_pImpl = NULL;
|
||||
boost::once_flag g_ImplInitialized = BOOST_ONCE_INIT;
|
||||
void initImpl()
|
||||
{
|
||||
static Impl g_Impl;
|
||||
g_pImpl = &g_Impl;
|
||||
}
|
||||
Impl &getImpl()
|
||||
{
|
||||
// construct after DebugEngine
|
||||
static Impl g_Impl;
|
||||
return g_Impl;
|
||||
boost::call_once(&initImpl, g_ImplInitialized);
|
||||
return *g_pImpl;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user