Use std::once_flag instead of pthread_once_t.