songfj / cppthreadpool

Automatically exported from code.google.com/p/cppthreadpool
0 stars 0 forks source link

repeated call for threadpool issue? #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When first time, i.e., k = 0, called, there is absolutely no problem. But when 
k = 1, the application terminates.Irrespective of the logic, the subsequent 
call to threadpool creates the issue of abnormal termination.
...
.....

int main(int argc, char **argv)
{
    for(int k=0;k<2;k++) {

        ThreadPool* myPool = new ThreadPool(25);
        myPool->initializeThreads();

        for(unsigned int i=0;i<ITERATIONS;i++){
            SampleWorkerThread* myThread = new SampleWorkerThread(i);
            myPool->assignWork(myThread);
        }
        myPool->destroyPool(2);

        delete myPool;
    }

    return 0;
}

Original issue reported on code.google.com by akilan.t...@gmail.com on 20 Feb 2013 at 2:46