diff --git a/src/myx/filesystem/paths.cpp b/src/myx/filesystem/paths.cpp index 3e131bb..9920e2d 100644 --- a/src/myx/filesystem/paths.cpp +++ b/src/myx/filesystem/paths.cpp @@ -13,6 +13,23 @@ namespace filesystem { Paths::Paths() = default; +Paths* Paths::getInstance() +{ + volatile Paths* localInstance = mInstance.load( std::memory_order_acquire ); + if ( !localInstance ) + { + std::lock_guard< std::mutex > myLock( mMutex ); + localInstance = mInstance.load( std::memory_order_relaxed ); + if ( !localInstance ) // -V1036 + { + localInstance = new Paths(); + mInstance.store( const_cast< Paths* >( localInstance ), std::memory_order_release ); + } + } + return( const_cast< Paths* >( localInstance ) ); +} + + Paths::HierarchyType Paths::getHierarchyType() { QRegExp binRegexp( "/s*bin$" ); diff --git a/src/myx/filesystem/paths.hpp b/src/myx/filesystem/paths.hpp index 3eaa4c6..0f7a008 100644 --- a/src/myx/filesystem/paths.hpp +++ b/src/myx/filesystem/paths.hpp @@ -91,22 +91,7 @@ public: * @brief getInstance * @return Уникальный экземпляр класса Paths */ - static Paths* getInstance() - { - volatile Paths* localInstance = mInstance.load( std::memory_order_acquire ); - if ( !localInstance ) - { - std::lock_guard< std::mutex > myLock( mMutex ); - localInstance = mInstance.load( std::memory_order_relaxed ); - if ( !localInstance ) // -V1036 - { - localInstance = new Paths(); - mInstance.store( const_cast< Paths* >( localInstance ), std::memory_order_release ); - } - } - return( const_cast< Paths* >( localInstance ) ); - } - + static Paths* getInstance(); /** * @brief Обновление путей с учётом расположения исполняемого файла