use c++11 thread local construct instead of boost

This commit is contained in:
Hieu Hoang 2020-01-05 18:09:57 -08:00
parent fdabcd34f8
commit 745e03b4fc
2 changed files with 11 additions and 4 deletions

View File

@ -20,6 +20,9 @@ using namespace std;
namespace Moses2
{
thread_local MemPool System::m_managerPool;
thread_local MemPool System::m_systemPool;
System::System(const Parameter &paramsArg) :
params(paramsArg), featureFunctions(*this)
{
@ -163,12 +166,12 @@ void System::LoadDecodeGraphBackoff()
MemPool &System::GetSystemPool() const
{
return GetThreadSpecificObj(m_systemPool);
return m_systemPool;
}
MemPool &System::GetManagerPool() const
{
return GetThreadSpecificObj(m_managerPool);
return m_managerPool;
}
FactorCollection &System::GetVocab() const

View File

@ -65,11 +65,15 @@ public:
protected:
mutable FactorCollection m_vocab;
mutable boost::thread_specific_ptr<MemPool> m_managerPool;
mutable boost::thread_specific_ptr<MemPool> m_systemPool;
//mutable boost::thread_specific_ptr<MemPool> m_managerPool;
//mutable boost::thread_specific_ptr<MemPool> m_systemPool;
thread_local static MemPool m_managerPool;
thread_local static MemPool m_systemPool;
mutable boost::thread_specific_ptr<Recycler<HypothesisBase*> > m_hypoRecycler;
//thread_local static MemPool d;
mutable boost::thread_specific_ptr<Batch> m_batch;
void LoadWeights();