Quick Q: What's the right way to write Double-Checked Locking in C++11? -- StackOverflow

Quick A: std::once_flag + std::call_once.

Double-checked locking in C++11?

From the selected answer ([edit] added):

I suggest forgetting about double-checked locking [by hand]. C++ provides a very useful tool for this kind of situation in the form of std::call_once, so use that....

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.