【发布时间】:2012-06-30 19:18:25
【问题描述】:
我想创建一个线程池。我有一个名为 ServerThread.cpp 的类,它的构造函数应该做这样的事情:
ServerThread::ServerThread()
{
for( int i=0 ; i<init_thr_num ; i++ )
{
//create a pool of threads
//suspend them, they will wake up when requests arrive for them to process
}
}
我想知道在构造函数中创建 pthread 是否会导致任何应该避免遇到的未定义行为。
谢谢
【问题讨论】:
标签: c++ multithreading constructor pthreads threadpool