Commit 47586728 authored by Valentin Platzgummer's avatar Valentin Platzgummer

temp

parent 22c1b55e
......@@ -325,22 +325,15 @@ bool MeasurementArea::isCorrect() {
void MeasurementArea::updateProgress(const ProgressArray &array) {
if (ready() && !_holdProgress && array.size() > 0) {
bool anyChanges = false;
long counter = 0;
for (const auto &lp : array) {
qDebug() << "MeasurementArea::updateProgress: counter = " << counter++;
auto it = _indexMap.find(lp.id());
if (it != _indexMap.end()) {
int tileIndex = it->second;
auto *tile = _tiles->value<MeasurementTile *>(tileIndex);
qDebug() << "MeasurementArea::updateProgress: progress before = "
<< tile->progress();
if (!qFuzzyCompare(lp.progress(), tile->progress())) {
tile->setProgress(lp.progress());
anyChanges = true;
}
qDebug() << "MeasurementArea::updateProgress: progress after = "
<< tile->progress();
}
}
......
......@@ -28,7 +28,10 @@ public:
_init();
}
FutureType future() const { return _future; }
FutureType future() const {
Q_ASSERT(this->_state != STATE::EMPTY);
return _future;
}
void setFuture(const FutureType &future) {
_future = future;
......@@ -37,9 +40,13 @@ public:
emit started();
}
T result() { return _future.get(); }
T result() {
Q_ASSERT(this->_state != STATE::EMPTY);
return _future.get();
}
virtual void waitForFinished() override {
Q_ASSERT(this->_state != STATE::EMPTY);
if (_state == STATE::STARTED) {
_timer.stop();
_future.wait();
......@@ -53,9 +60,11 @@ public:
private:
void _onTimeout() {
Q_ASSERT(this->_state == STATE::STARTED);
if (_state == STATE::STARTED) {
auto status = _future.wait_for(std::chrono::seconds(0));
if (status == std::future_status::ready) {
_timer.stop();
_state = STATE::FINISHED;
emit finished();
}
......
......@@ -91,6 +91,7 @@ void TaskDispatcher::run() {
ULock lk1(this->_mutex);
if (this->_taskQueue.size() > 0 && this->_running) {
Q_ASSERT(this->_taskQueue.size() == this->_promiseQueue.size());
// pop task and promise
auto pTask = std::move(this->_taskQueue.front());
auto promise = std::move(this->_promiseQueue.front());
......
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