Advertisement
frasl

Untitled

Mar 4th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. Singleton* Singleton::getInstance() {
  2.     if (m_instance == nullptr) {
  3.         std::lock_guard<std::mutex> lock(m_mutex);
  4.         if (m_instance == nullptr) {
  5.             m_instance = new Singleton();
  6.         }
  7.     }
  8.     return m_instance;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement