a threadpool write in c++