Потокобезопасная версия в отдельном классе и удаление лишних методов

This commit is contained in:
2020-04-09 09:34:55 +03:00
parent df9b2ff599
commit a39e514278
4 changed files with 29 additions and 187 deletions

View File

@ -3,25 +3,34 @@
#include <myx/base/config.hpp>
#include <myx/filesystem/paths.hpp>
#include <myx/filesystem/paths_mt.hpp>
#include <QCoreApplication>
#include <QDebug>
namespace MF = myx::filesystem;
// Переменные для защиты экземпляра класса MF::Paths
std::atomic< MF::Paths* > MF::Paths::mInstance;
std::mutex MF::Paths::mMutex;
// Переменные для защиты экземпляра класса MF::PathsMT
std::atomic< MF::PathsMT* > MF::PathsMT::mInstance;
std::mutex MF::PathsMT::mMutex;
int main( int argc, char** argv )
{
(void)argc;
(void)argv;
QCoreApplication::setApplicationName( QStringLiteral( CMLIB_PROJECT_NAME ) );
MF::Paths* paths = MF::Paths::getInstance();
MF::PathsMT* pathsMT = MF::PathsMT::instance();
MF::Paths* paths = MF::Paths::instance();
pathsMT->init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
pathsMT->findConfigFile( QStringLiteral( "test" ) );
qDebug() << pathsMT->systemLogDirectory();
qDebug() << pathsMT->systemConfigDirectory();
paths->init( QStringLiteral( CMLIB_PROJECT_NAME ), QStringLiteral( "conf" ) );
paths->makeDefaultDirectories();
paths->findConfigFile( QStringLiteral( "test" ) );
qDebug() << paths->systemConstDataDirectory();
qDebug() << paths->configFileName();
return( 0 );
}