Skip to content

Commit

Permalink
Add additional points
Browse files Browse the repository at this point in the history
  • Loading branch information
sramani-metro authored Dec 5, 2024
1 parent 870cc03 commit 83a5671
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Monitor/Monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ POP_WARNING()
}
inline void Open(PluginHost::IShell* service, Core::JSON::ArrayType<Config::Entry>::Iterator& index)
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */

ASSERT((service != nullptr) && (_service == nullptr));

uint64_t baseTime = Core::Time::Now().Ticks();
Expand Down Expand Up @@ -730,6 +732,8 @@ POP_WARNING()
}
inline void Close()
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */

ASSERT(_service != nullptr);

_job.Revoke();
Expand All @@ -740,6 +744,8 @@ POP_WARNING()
}
void Activated (const string& callsign, PluginHost::IShell* service) override
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */

MonitorObjectContainer::iterator index(_monitor.find(callsign));

if (index != _monitor.end()) {
Expand All @@ -761,6 +767,8 @@ POP_WARNING()
}
void Deactivated (const string& callsign, PluginHost::IShell* service) override
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */

MonitorObjectContainer::iterator index(_monitor.find(callsign));

if (index != _monitor.end()) {
Expand Down Expand Up @@ -793,6 +801,7 @@ POP_WARNING()
}
void Snapshot(Core::JSON::ArrayType<Monitor::Data>& snapshot) const
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */
MonitorObjectContainer::const_iterator element(_monitor.cbegin());

// Go through the list of observations...
Expand All @@ -807,6 +816,7 @@ POP_WARNING()
}
bool Snapshot(const string& name, Monitor::MetaData& result, bool& operational) const
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */
bool found = false;


Expand Down Expand Up @@ -848,7 +858,7 @@ POP_WARNING()

void Snapshot(const string& callsign, Core::JSON::ArrayType<JsonData::Monitor::InfoInfo>* response) const
{

/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */
ASSERT(response != nullptr);

if (callsign.empty() == false) {
Expand All @@ -865,6 +875,7 @@ POP_WARNING()

bool Reset(const string& name, Monitor::MetaData& result, bool& operational)
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */
bool found = false;

MonitorObjectContainer::iterator index(_monitor.find(name));
Expand All @@ -881,6 +892,7 @@ POP_WARNING()

bool Reset(const string& name)
{
/* See comment in the Dispatch method on why no locking is here to protect the _monitor member */
bool found = false;

MonitorObjectContainer::iterator index(_monitor.find(name));
Expand Down Expand Up @@ -916,6 +928,9 @@ POP_WARNING()
* Snapshot (generating snapshots)
* Activated and Deactivated (modifying individual MonitorObject entries)
*
* It was made sure in the plugin Initialize/Deinitialze that the Activated/Deactivated notification
* cannot happen while Open/Close are called. It is important not to change the sequence of the code in Initialize/Deinitialize.
*
* Many of the member variables in MonitorObject (e.g., _nextSlot, _restartWindow, _active) are declared as std::atomic.
* These variables ensure thread-safe access without the need for explicit locking. Some of them are defined as const making them immutable.
*
Expand Down

0 comments on commit 83a5671

Please sign in to comment.