30const size_t g_sleeptime = 10000000;
31const size_t g_multTasks = 32;
35enum EProc {
start, clean};
41 bool runTask(EProc ) {
46 unsigned long threadID()
const {
55void threadPool(
size_t _numThreads = 4,
bool _needDbg =
false)
57 cout <<
"ThreadPool: starting..." << endl;
59 size_t numTasks(_numThreads * g_multTasks);
67 vector <TTestTask> tasksList(numTasks);
69 cout <<
"ThreadPool: getting tasks..." << endl;
70 cout <<
"ThreadPool: processing tasks..." << endl;
73 for (
size_t i = 0; i < numTasks; ++i) {
74 threadPool.PushTask(tasksList[i], start);
80 threadPool.Stop(
true);
81 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.