#include #include #include #include #include #include #include"../header/CThreadPool_Ret.hpp" namespace { std::mutex mut; size_t get() { using namespace std; static mt19937 mu{static_cast(chrono::high_resolution_clock::now().time_since_epoch().count())}; return mu()%4; } std::size_t add_func(const std::size_t i) { using namespace std; const auto sec{get()}; this_thread::sleep_for(chrono::seconds{sec}); lock_guard lock{mut}; cout<<"thread "< tp{4}; //merely size_t, not size_t() queue::thread_id> que; for(size_t i{0};i!=tp.size();++i) que.emplace(tp.add(add_func,size_t(i))); tp.wait(que.front()); //tp will block here until thread[que.front()] complete cout<