-
Notifications
You must be signed in to change notification settings - Fork 617
Fix broken runtime config sync #10013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2218ebd
1a55b68
433e2de
099f664
546dea9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
yhabteab marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,12 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include "base/type.hpp" | ||
| #include "base/string.hpp" | ||
| #include <condition_variable> | ||
| #include <map> | ||
| #include <mutex> | ||
| #include <set> | ||
|
|
||
| #ifndef _WIN32 | ||
| #include <boost/interprocess/sync/interprocess_sharable_mutex.hpp> | ||
|
|
@@ -69,4 +74,29 @@ class ConfigObjectsSharedLock | |
|
|
||
| #endif /* _WIN32 */ | ||
|
|
||
|
|
||
| /** | ||
| * Allows you to easily lock/unlock a specific object of a given type by its name. | ||
| * | ||
| * That way, locking an object "this" of type Host does not affect an object "this" of | ||
| * type "Service" nor an object "other" of type "Host". | ||
| * | ||
| * @ingroup remote | ||
| */ | ||
| class ObjectNameLock | ||
| { | ||
| public: | ||
| ObjectNameLock(const Type::Ptr& ptype, const String& objName); | ||
|
|
||
| ~ObjectNameLock(); | ||
|
|
||
| private: | ||
| String m_ObjectName; | ||
| Type::Ptr m_Type; | ||
|
|
||
| static std::mutex m_Mutex; | ||
| static std::condition_variable m_CV; | ||
| static std::map<Type*, std::set<String>> m_LockedObjectNames; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider unordered_{map,set}.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exact types won't matter that much here as the overall size of those containers will stay rather small anyways. For completeness, as I already talked with @yhabteab about it: I was thinking about maybe making this a
yhabteab marked this conversation as resolved.
|
||
| }; | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.