std::call_once

C++11特性之std:call_once介绍 - 知乎

std:call_once是C++11引入的新特性,如需使用,只需要#include 即可,简单来说std:call_once的作用,确保函数或代码片段在多线程环境下,只需要执行一次,常用的场景如Init()操作或一些系统参数的获取等。

相对来说,std::call_once用法比较简单,配合std::once_flag即可实现

你可能感兴趣的:(linux)