Skip to content

Commit

Permalink
Uniform naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
xfmy committed Nov 20, 2023
1 parent 44592ef commit bc3ca52
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cpputil/singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
private: \
DISABLE_COPY(Class) \
static Class* s_pInstance; \
static std::once_flag initFlag; \
static std::once_flag s_initFlag; \
static std::mutex s_mutex;

#define SINGLETON_IMPL(Class) \
Class* Class::s_pInstance = NULL; \
std::once_flag Class::initFlag; \
std::once_flag Class::s_initFlag; \
std::mutex Class::s_mutex; \
Class* Class::instance() { \
std::call_once(initFlag, []() {s_pInstance = new Class;}); \
std::call_once(s_initFlag, []() {s_pInstance = new Class;}); \
return s_pInstance; \
} \
void Class::exitInstance() { \
Expand Down

0 comments on commit bc3ca52

Please sign in to comment.