mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +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()
|
||||
{
|
||||
m_HasMatches = true;
|
||||
m_HasMatches.store(true, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "base/shared-object.hpp"
|
||||
#include "base/type.hpp"
|
||||
#include <unordered_map>
|
||||
#include <atomic>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
@ -101,7 +102,7 @@ private:
|
||||
bool m_IgnoreOnError;
|
||||
DebugInfo m_DebugInfo;
|
||||
Dictionary::Ptr m_Scope;
|
||||
bool m_HasMatches;
|
||||
std::atomic<bool> m_HasMatches;
|
||||
|
||||
static TypeMap m_Types;
|
||||
static RuleMap m_Rules;
|
||||
|
Loading…
x
Reference in New Issue
Block a user