mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
Merge pull request #9508 from Icinga/bugfix/fix-data-race-in-apply-rule
Fix data race in `ApplyRule` class
This commit is contained in:
commit
f59f361f09
@ -126,12 +126,12 @@ const std::vector<String>& ApplyRule::GetTargetTypes(const String& sourceType)
|
|||||||
|
|
||||||
void ApplyRule::AddMatch()
|
void ApplyRule::AddMatch()
|
||||||
{
|
{
|
||||||
m_HasMatches = true;
|
m_HasMatches.store(true, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplyRule::HasMatches() const
|
bool ApplyRule::HasMatches() const
|
||||||
{
|
{
|
||||||
return m_HasMatches;
|
return m_HasMatches.load(std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<ApplyRule::Ptr>& ApplyRule::GetRules(const Type::Ptr& sourceType, const Type::Ptr& targetType)
|
const std::vector<ApplyRule::Ptr>& ApplyRule::GetRules(const Type::Ptr& sourceType, const Type::Ptr& targetType)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "base/shared-object.hpp"
|
#include "base/shared-object.hpp"
|
||||||
#include "base/type.hpp"
|
#include "base/type.hpp"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -101,7 +102,7 @@ private:
|
|||||||
bool m_IgnoreOnError;
|
bool m_IgnoreOnError;
|
||||||
DebugInfo m_DebugInfo;
|
DebugInfo m_DebugInfo;
|
||||||
Dictionary::Ptr m_Scope;
|
Dictionary::Ptr m_Scope;
|
||||||
bool m_HasMatches;
|
std::atomic<bool> m_HasMatches;
|
||||||
|
|
||||||
static TypeMap m_Types;
|
static TypeMap m_Types;
|
||||||
static RuleMap m_Rules;
|
static RuleMap m_Rules;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user