get rid of boost thread local code

This commit is contained in:
Hieu Hoang 2020-01-05 18:56:49 -08:00
parent 745e03b4fc
commit f46ee7c5ac
3 changed files with 3 additions and 17 deletions

View File

@ -22,6 +22,7 @@ namespace Moses2
thread_local MemPool System::m_managerPool;
thread_local MemPool System::m_systemPool;
thread_local Recycler<HypothesisBase*> System::m_hypoRecycler;
System::System(const Parameter &paramsArg) :
params(paramsArg), featureFunctions(*this)
@ -181,7 +182,7 @@ FactorCollection &System::GetVocab() const
Recycler<HypothesisBase*> &System::GetHypoRecycler() const
{
return GetThreadSpecificObj(m_hypoRecycler);
return m_hypoRecycler;
}
Batch &System::GetBatch(MemPool &pool) const

View File

@ -69,8 +69,7 @@ protected:
//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 Recycler<HypothesisBase*> m_hypoRecycler;
//thread_local static MemPool d;

View File

@ -311,20 +311,6 @@ void Swap(T &a, T &b)
b = c;
}
template<typename T>
T &GetThreadSpecificObj(boost::thread_specific_ptr<T> &coll)
{
T *obj;
obj = coll.get();
if (obj == NULL) {
obj = new T;
coll.reset(obj);
}
assert(obj);
return *obj;
}
// grab the underlying contain of priority queue
template<class T, class S, class C>
S& Container(std::priority_queue<T, S, C>& q)