mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
get rid of boost thread local code
This commit is contained in:
parent
745e03b4fc
commit
f46ee7c5ac
@ -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 ¶msArg) :
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user