11.3.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 6ade6e78 authored by schultezub's avatar schultezub

Fixed bug that Processor's invalidations get lost when processor is locked

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@465 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent fc707dcd
......@@ -34,7 +34,6 @@
#include "tgt/logmanager.h"
#include "tbb/spin_mutex.h"
#include "tbb/mutex.h"
#include "core/tools/invalidationlevel.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/propertycollection.h"
......
......@@ -68,7 +68,13 @@ namespace campvis {
void AbstractProcessor::unlockProcessor() {
tgtAssert(_locked == true, "Called AbstractProcessor::unlockProcessor() on unlocked processor!");
unlockAllProperties();
int summed = VALID;
int il;
while (_queuedInvalidations.try_pop(il)) {
summed |= il;
}
_locked = false;
invalidate(summed);
}
bool AbstractProcessor::isLocked() {
......@@ -89,11 +95,17 @@ namespace campvis {
}
void AbstractProcessor::invalidate(int level) {
int tmp;
do {
tmp = _level;
} while (_level.compare_and_swap(tmp | level, tmp) != tmp);
s_invalidated(this);
if (_locked) {
// TODO: this is not 100% thread-safe - an invalidation might slip through if the processor is unlocked during invalidation
_queuedInvalidations.push(level);
}
else {
int tmp;
do {
tmp = _level;
} while (_level.compare_and_swap(tmp | level, tmp) != tmp);
s_invalidated(this);
}
}
void AbstractProcessor::validate(int level) {
......
......@@ -32,6 +32,7 @@
#include "sigslot/sigslot.h"
#include "tbb/atomic.h"
#include "tbb/concurrent_queue.h"
#include "tgt/logmanager.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/propertycollection.h"
......@@ -250,7 +251,8 @@ namespace campvis {
tbb::atomic<bool> _locked;
private:
tbb::atomic<int> _level; ///< current invalidation level
tbb::atomic<int> _level; ///< current invalidation level
tbb::concurrent_queue<int> _queuedInvalidations;
static const std::string loggerCat_;
};
......
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