forked from organicmaps/organicmaps
[drape] rename strange thread pool to SimpleThreadPool
This commit is contained in:
parent
609e24d158
commit
49bebaa308
4 changed files with 12 additions and 12 deletions
|
@ -180,12 +180,12 @@ namespace threads
|
|||
}
|
||||
|
||||
|
||||
ThreadPool::ThreadPool(size_t reserve)
|
||||
SimpleThreadPool::SimpleThreadPool(size_t reserve)
|
||||
{
|
||||
m_pool.reserve(reserve);
|
||||
}
|
||||
|
||||
ThreadPool::~ThreadPool()
|
||||
SimpleThreadPool::~SimpleThreadPool()
|
||||
{
|
||||
for (size_t i = 0; i < m_pool.size(); ++i)
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ namespace threads
|
|||
}
|
||||
}
|
||||
|
||||
void ThreadPool::Add(IRoutine * pRoutine)
|
||||
void SimpleThreadPool::Add(IRoutine * pRoutine)
|
||||
{
|
||||
ValueT v;
|
||||
v.first = new Thread();
|
||||
|
@ -205,13 +205,13 @@ namespace threads
|
|||
v.first->Create(pRoutine);
|
||||
}
|
||||
|
||||
void ThreadPool::Join()
|
||||
void SimpleThreadPool::Join()
|
||||
{
|
||||
for (size_t i = 0; i < m_pool.size(); ++i)
|
||||
m_pool[i].first->Join();
|
||||
}
|
||||
|
||||
IRoutine * ThreadPool::GetRoutine(size_t i) const
|
||||
IRoutine * SimpleThreadPool::GetRoutine(size_t i) const
|
||||
{
|
||||
return m_pool[i].second;
|
||||
}
|
||||
|
|
|
@ -56,17 +56,17 @@ namespace threads
|
|||
};
|
||||
|
||||
/// Simple threads container. Takes ownership for every added IRoutine.
|
||||
class ThreadPool
|
||||
class SimpleThreadPool
|
||||
{
|
||||
typedef pair<Thread *, IRoutine *> ValueT;
|
||||
vector<ValueT> m_pool;
|
||||
|
||||
ThreadPool(ThreadPool const &);
|
||||
ThreadPool & operator=(Thread const &);
|
||||
SimpleThreadPool(SimpleThreadPool const &);
|
||||
SimpleThreadPool & operator=(Thread const &);
|
||||
|
||||
public:
|
||||
ThreadPool(size_t reserve = 0);
|
||||
~ThreadPool();
|
||||
SimpleThreadPool(size_t reserve = 0);
|
||||
~SimpleThreadPool();
|
||||
|
||||
void Add(IRoutine * pRoutine);
|
||||
void Join();
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace
|
|||
srand(666);
|
||||
|
||||
size_t const count = 20;
|
||||
threads::ThreadPool pool(count);
|
||||
threads::SimpleThreadPool pool(count);
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
pool.Add(new FeaturesLoader(src));
|
||||
|
|
|
@ -106,7 +106,7 @@ UNIT_TEST(ApkReader_Multithreaded)
|
|||
srand(static_cast<unsigned>(size));
|
||||
|
||||
size_t const count = 20;
|
||||
threads::ThreadPool pool(count);
|
||||
threads::SimpleThreadPool pool(count);
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
pool.Add(new ApkTester(path));
|
||||
|
|
Loading…
Add table
Reference in a new issue