We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0c978f commit cdb7725Copy full SHA for cdb7725
src/error_detector.cpp
@@ -5,10 +5,12 @@
5
#include <sstream>
6
#include <dirent.h>
7
#include <cstring>
8
+#include <mutex>
9
10
// Static member initialization
11
std::vector<ErrorDefinition> ErrorDetector::errorDefinitions;
12
bool ErrorDetector::definitionsLoaded = false;
13
+static std::once_flag initFlag;
14
15
namespace {
16
// Case-insensitive string comparison
@@ -121,9 +123,9 @@ void ErrorDetector::loadErrorDefinitions(const std::string& configDir) {
121
123
}
122
124
125
void ErrorDetector::ensureLoaded() {
- if (!definitionsLoaded) {
126
+ std::call_once(initFlag, []() {
127
loadErrorDefinitions();
- }
128
+ });
129
130
131
bool ErrorDetector::isErrorReading(const std::map<std::string, std::string>& reading) {
0 commit comments