0
以下のtcpserverクラスファイルがあります。メインクラスにインスタンスを作成して実行すると、boost_groupに「未解決の関数型」エラーが表示されます。 :: create_thread機能私は理由何見当がつかない私は方法を「CONST」が、運を変更しようとした任意のヘルプはにappriciatedboost :: thread_group :: create_thread(<未解決のオーバーロードされた関数型>エラー
void tcpserver::WorkerThread() const
{
printf("test");
// std::cout << "Thread Start\n";
// io_service.run();
// std::cout << "Thread Finish\n";
}
void tcpserver::StartServer() const {
boost::shared_ptr<boost::asio::io_service::work> work(
new boost::asio::io_service::work(io_service)
);
std::cout << "Press [return] to exit." << std::endl;
boost::thread_group worker_threads;
for(int x = 0; x < 4; ++x)
{
worker_threads.create_thread(WorkerThread);
}
std::cin.get();
io_service.stop();
worker_threads.join_all();
}
ありがとうございます。ラムダ式はうまく機能しているようです。 –
はcreate_thread関数呼び出しを以下のように変更しました。 worker_threads.create_thread([this] {WorkerThread();}); –