Replace pthread_create with std::thread