replace pthread with std::thread