lock_guard for cfm
This commit is contained in:
@@ -6,11 +6,14 @@
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include "definitions.h"
|
||||
|
||||
class configfilemanager{
|
||||
private:
|
||||
std::map<std::string, std::string> configs;
|
||||
std::mutex mtx;
|
||||
|
||||
|
||||
public:
|
||||
configfilemanager(std::string filepath = "./ncsambawatcher.config")
|
||||
@@ -44,6 +47,7 @@ public:
|
||||
|
||||
std::string at(const std::string &config)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mtx);
|
||||
return configs.at(config);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user