Usage: 
root [0] .L threadPool.C++
root [1] threadPool(10)  10 = numThreads
 
#include <iostream>
#include <iterator>
#include <vector>
#ifndef _WIN32
#include <unistd.h>
#endif
 
using namespace std;
const size_t g_sleeptime = 1; 
const size_t g_multTasks = 50;
 
enum EProc {start, clean};
 
{
public:
   bool runTask(EProc ) {
      return true;
   }
   unsigned long threadID() const {
      return m_tid;
   }
 
private:
   unsigned long m_tid;
};
 
void threadPool(size_t _numThreads = 10, bool _needDbg = false)
{
   cout << "ThreadPool: starting..." << endl;
   
   size_t numTasks(_numThreads * g_multTasks);
 
   
   
   
 
   
   vector <TTestTask> tasksList(numTasks);
 
   cout << "ThreadPool: getting tasks..." << endl;
   cout << "ThreadPool: processing tasks..." << endl;
   
   
   for (size_t i = 0; i < numTasks; ++i) {
      threadPool.PushTask(tasksList[i], start);
   }
 
   
   
   
   threadPool.Stop(true);
   cout << "ThreadPool: done" << endl;
}
 
static Int_t Sleep(ULong_t secs, ULong_t nanos=0)
Static method to sleep the calling thread.
 
static Long_t SelfId()
Static method returning the id for the current thread.
 
- Author
 - Victor Perevovchikov 
 
Definition in file threadPool.C.