Usage:
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
where 5 is a number of Threads in the pool there will be then nThreads * 10 tasks pushed to the test
#include <iostream>
#include <iterator>
#include <vector>
#ifndef _WIN32
#include <unistd.h>
#endif
using std::ostream, std::map, std::cout, std::endl;
enum EProc {start, clean};
public:
return true;
}
}
private:
};
{
_stream <<
_task.threadID();
return _stream;
}
{
for (
size_t j = 0;
j < 4; ++
j )
{
cout <<
"+++++++++ Starting iteration #" <<
j <<
" ++++++++++++"<< endl;
}
cout << "\n ****** Drain the tasks queue ******" << endl;
}
cout << "\n Stopping..." << endl;
{
if (found == counter.
end())
counter.insert(counter_t::value_type(iter->threadID(), 1));
else {
found->second = found->second + 1;
}
}
}
cout << "\n************* RESULT ****************" << endl;
cout << "Thread " << iter->first << " was used " << iter->second << " times\n";
}
cout <<
"ThreadPool: the simple test status: " << (
testOK ?
"OK" :
"Failed") << endl;
}
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
const_iterator begin() const
const_iterator end() const
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 stressThreadPool.C.