- Examples

Let’s discuss the examples of thread-safe initialization of data in this lesson.

Example 1

The short example demonstrates the application of std::call_once and the std::once_flag. Both are declared in the header <mutex>.

Get hands-on with 1000+ tech skills courses.