30 const size_t g_sleeptime = 1; 
 
   31 const size_t g_multTasks = 50;
 
   35 enum EProc {start, clean};
 
   38 class TTestTask: 
public TThreadPoolTaskImp<TTestTask, EProc>
 
   41    bool runTask(EProc ) {
 
   42       m_tid = TThread::SelfId();
 
   43       TThread::Sleep(g_sleeptime, 0L);
 
   46    unsigned long threadID()
 const {
 
   55 void threadPool(
size_t _numThreads = 10, 
bool _needDbg = 
false)
 
   57    cout << 
"ThreadPool: starting..." << endl;
 
   59    size_t numTasks(_numThreads * g_multTasks);
 
   64    TThreadPool<TTestTask, EProc> threadPool(_numThreads, _needDbg);
 
   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;