Commit 0a2e7e02 authored by Alessio Netti's avatar Alessio Netti

Improving spinlocks in CollectAgent SensorCache

parent 7c31ca3f
......@@ -152,6 +152,7 @@ bool sensorGroupQueryCallback(const std::vector<string>& names, const uint64_t s
// Creating a SID to perform the query
if (sid.mqttTopicConvert(topic)) {
try {
mySensorCache.wait();
if (sensorMap.count(sid) > 0 && sensorMap[sid].getView(startTs, endTs, buffer, rel)) {
// Data was found, can continue to next SID
successCtr++;
......
......@@ -105,6 +105,14 @@ public:
**/
uint64_t clean(uint64_t t);
/**
* @brief Waits for internal updates to finish.
*/
const void wait() {
while(_updating.load()) {}
return;
}
/**
* @brief Set a new maximum cache length.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment