I am working on a Boost thread pool.
I have a structure like this:
class SimThreadPool
{
static SimThreadPool* getInstance();
boost::threadpool::prio_pool& getThreadPool() { return mThreadPool; }
simTerrain::SimThreadPool::SimThreadPool()
: mThreadPool(boost::threadpool::fifo_pool(1))
{
}
boost::threadpool::prio_pool mThreadPool;
}
When I need a thread, I call it like this:
SimThreadPool::getInstance()->getThreadPool().schedule(MyThread());
and it works.
The question is: how can I convert this thread pool from fifo to priority?
I changed all of mine fifo\_poolto , but I couldn’t do it - it didn’t work. I got some errors. prio\_pool
How can I use prio_poolin this situation?
I think I should use prio_task_funcinstead of the class, but I want to reuse existing algorithms for this purpose.
source
share