std::thread instead of pthread