Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 6ade6e78 authored by schultezub's avatar schultezub
Browse files

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