Реализация в cpp
This commit is contained in:
parent
ce596d8113
commit
76a655aa6c
@ -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$" );
|
||||
|
@ -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 Обновление путей с учётом расположения исполняемого файла
|
||||
|
Loading…
Reference in New Issue
Block a user