Below is some code showing a simple and short implementation of a thread pool.
The code is inspired by this post.
I compile it with clang++ -std=c++11 threadpool.cpp -o threadpool -lpthread
When executed I got following:
./threadpool
terminate called without an active exception
As I see, the problem is getting out of function pool_t::pop() and its infinite loop.
My question is, how to get elegantly out of the loop?
Aucun commentaire:
Enregistrer un commentaire