Skip to content

Commit

Permalink
Merge pull request #32276 from vespa-engine/toregge/use-nullptr-in-fs…
Browse files Browse the repository at this point in the history
…a-fsamanagers-singleton

Use nullptr in singleton class in fsa module.
  • Loading branch information
toregge authored Aug 27, 2024
2 parents d58b854 + e962aea commit 839fde9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fsa/src/vespa/fsamanagers/singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ template<typename T> Singleton<T>::~Singleton() {}
template<typename T> void Singleton<T>::destroy()
{
delete _instance;
_instance = NULL;
_instance = nullptr;
}

template<typename T> T& Singleton<T>::instance()
{
if (_instance == NULL) {
if (_instance == nullptr) {
_lock.lock();
if (_instance == NULL) {
if (_instance == nullptr) {
SingletonExitHandler::instance()->registerSingletonDestroyer(&destroy);
_instance = new T();
}
Expand All @@ -162,7 +162,7 @@ template<typename T> T& Singleton<T>::instance()
return *_instance;
}

template<typename T> T* Singleton<T>::_instance = NULL;
template<typename T> T* Singleton<T>::_instance = nullptr;

template<typename T> Mutex Singleton<T>::_lock;

Expand Down

0 comments on commit 839fde9

Please sign in to comment.