I m using it for multi thread part on my project .. i m working around Notification Queue.
like sample i see in main:
- Code: Select all
std::cout << "USED " << ThreadPool::defaultPool().used() << std::endl;
// distribute some work
for (int i = 0; i < 50; ++i)
TestPointer * point=new TestPointer();
// wait until queue is empty and all threads are
// waiting for new work.
In code we need a Sleep 200 to complete last operation thread because the queue is empty but some thread needs more time to complete its work,
now, Sleep is very bad for my application(it run at 300-400 Hz).
So i resolved adding a new attribute in NQ's code:
int NotificationQueue::getIdlesThreads() const
So, i know : if getIdleThreads() == nWorkerThread im sure that all thread have finished.
Sry for my english... i hope to be clear.