Mercurial > hg > svcore
diff data/model/EditableDenseThreeDimensionalModel.cpp @ 536:beb51f558e9c
* Change QMutex in Editable DTDM to a read/write lock
author | Chris Cannam |
---|---|
date | Mon, 26 Jan 2009 15:18:32 +0000 |
parents | 3ccf48fb81d6 |
children | 3cc4b7cd2aa5 |
line wrap: on
line diff
--- a/data/model/EditableDenseThreeDimensionalModel.cpp Fri Jan 23 14:00:29 2009 +0000 +++ b/data/model/EditableDenseThreeDimensionalModel.cpp Mon Jan 26 15:18:32 2009 +0000 @@ -19,6 +19,8 @@ #include <QTextStream> #include <QStringList> +#include <QReadLocker> +#include <QWriteLocker> #include <iostream> @@ -71,7 +73,7 @@ Model * EditableDenseThreeDimensionalModel::clone() const { - QMutexLocker locker(&m_mutex); + QReadLocker locker(&m_lock); EditableDenseThreeDimensionalModel *model = new EditableDenseThreeDimensionalModel @@ -145,7 +147,7 @@ EditableDenseThreeDimensionalModel::Column EditableDenseThreeDimensionalModel::getColumn(size_t index) const { - QMutexLocker locker(&m_mutex); + QReadLocker locker(&m_lock); if (index >= m_data.size()) return Column(); return expandAndRetrieve(index); } @@ -308,7 +310,7 @@ EditableDenseThreeDimensionalModel::setColumn(size_t index, const Column &values) { - QMutexLocker locker(&m_mutex); + QWriteLocker locker(&m_lock); while (index >= m_data.size()) { m_data.push_back(Column()); @@ -391,7 +393,7 @@ bool EditableDenseThreeDimensionalModel::shouldUseLogValueScale() const { - QMutexLocker locker(&m_mutex); + QReadLocker locker(&m_lock); QVector<float> sample; QVector<int> n; @@ -450,7 +452,7 @@ QString EditableDenseThreeDimensionalModel::toDelimitedDataString(QString delimiter) const { - QMutexLocker locker(&m_mutex); + QReadLocker locker(&m_lock); QString s; for (size_t i = 0; i < m_data.size(); ++i) { QStringList list; @@ -467,7 +469,7 @@ QString indent, QString extraAttributes) const { - QMutexLocker locker(&m_mutex); + QReadLocker locker(&m_lock); // For historical reasons we read and write "resolution" as "windowSize"