diff --git a/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h b/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h index d67ee83a3c0de7f2a375a1a68a3201443c745da4..d9eedc4e68d958c039db98163c1282ee7e8bd0c6 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h +++ b/Framework/DataObjects/inc/MantidDataObjects/BoxControllerNeXusIO.h @@ -4,7 +4,6 @@ #include "MantidAPI/IBoxControllerIO.h" #include "MantidAPI/BoxController.h" #include "MantidKernel/DiskBuffer.h" -#include <Poco/Mutex.h> #include <nexus/NeXusFile.hpp> namespace Mantid { @@ -102,9 +101,8 @@ private: /// the vector, which describes the event specific data size, namely how many /// column an event is composed into and this class reads/writres std::vector<int64_t> m_BlockSize; - /// lock Nexus file operations as Nexus is not thread safe // Poco::Mutex -- > - /// is recursive. - mutable Poco::FastMutex m_fileMutex; + /// lock Nexus file operations as Nexus is not thread safe + mutable Mantid::Kernel::Mutex m_fileMutex; // Mainly static information which may be split into different IO classes // selected through chein of responsibility. diff --git a/Framework/DataObjects/src/BoxControllerNeXusIO.cpp b/Framework/DataObjects/src/BoxControllerNeXusIO.cpp index 61a23013ceea48e68f52d93286184d00fe8b863f..6bb288a89aab4d435e85a6acd974032da91634dd 100644 --- a/Framework/DataObjects/src/BoxControllerNeXusIO.cpp +++ b/Framework/DataObjects/src/BoxControllerNeXusIO.cpp @@ -116,7 +116,7 @@ bool BoxControllerNeXusIO::openFile(const std::string &fileName, if (m_File) return false; - Poco::ScopedLock<Poco::FastMutex> _lock(m_fileMutex); + Mantid::Kernel::LockGuardMutex _lock(m_fileMutex); m_ReadOnly = true; if (mode.find("w") != std::string::npos || mode.find("W") != std::string::npos) { @@ -332,7 +332,7 @@ void BoxControllerNeXusIO::saveGenericBlock( // Specify the dimensions std::vector<int64_t> dims(m_BlockSize); - Poco::ScopedLock<Poco::FastMutex> _lock(m_fileMutex); + Mantid::Kernel::LockGuardMutex _lock(m_fileMutex); start[0] = int64_t(blockPosition); dims[0] = int64_t(DataBlock.size() / this->getNDataColums()); @@ -384,7 +384,7 @@ void BoxControllerNeXusIO::loadGenericBlock(std::vector<Type> &Block, std::vector<int64_t> start(2, 0); std::vector<int64_t> size(m_BlockSize); - Poco::ScopedLock<Poco::FastMutex> _lock(m_fileMutex); + Mantid::Kernel::LockGuardMutex _lock(m_fileMutex); start[0] = static_cast<int64_t>(blockPosition); size[0] = static_cast<int64_t>(nPoints); @@ -457,7 +457,7 @@ void BoxControllerNeXusIO::loadBlock(std::vector<double> &Block, /// Clear NeXus internal cache void BoxControllerNeXusIO::flushData() const { - Poco::ScopedLock<Poco::FastMutex> _lock(m_fileMutex); + Mantid::Kernel::LockGuardMutex _lock(m_fileMutex); m_File->flush(); } /** flush disk buffer data from memory and close underlying NeXus file*/ @@ -466,7 +466,7 @@ void BoxControllerNeXusIO::closeFile() { // write all file-backed data still stack in the data buffer into the file. this->flushCache(); // lock file - Poco::ScopedLock<Poco::FastMutex> _lock(m_fileMutex); + Mantid::Kernel::LockGuardMutex _lock(m_fileMutex); { m_File->closeData(); // close events data diff --git a/Framework/DataObjects/src/EventWorkspaceMRU.cpp b/Framework/DataObjects/src/EventWorkspaceMRU.cpp index 6025691a5f8bca50cc5d71dada4e452929c17804..0ae1ef7c0ff67727577ebfbb2159b9d019425950 100644 --- a/Framework/DataObjects/src/EventWorkspaceMRU.cpp +++ b/Framework/DataObjects/src/EventWorkspaceMRU.cpp @@ -4,8 +4,6 @@ namespace Mantid { namespace DataObjects { -using Mantid::Kernel::Mutex; - //---------------------------------------------------------------------------------------------- /** Constructor */ @@ -41,7 +39,7 @@ EventWorkspaceMRU::~EventWorkspaceMRU() { * @param thread_num :: thread number that wants a MRU buffer */ void EventWorkspaceMRU::ensureEnoughBuffersE(size_t thread_num) const { - Mutex::ScopedLock _lock(m_changeMruListsMutexE); + Mantid::Kernel::LockGuardMutex _lock(m_changeMruListsMutexE); if (m_bufferedDataE.size() <= thread_num) { m_bufferedDataE.resize(thread_num + 1, nullptr); for (auto &data : m_bufferedDataE) { @@ -56,7 +54,7 @@ void EventWorkspaceMRU::ensureEnoughBuffersE(size_t thread_num) const { * @param thread_num :: thread number that wants a MRU buffer */ void EventWorkspaceMRU::ensureEnoughBuffersY(size_t thread_num) const { - Mutex::ScopedLock _lock(m_changeMruListsMutexY); + Mantid::Kernel::LockGuardMutex _lock(m_changeMruListsMutexY); if (m_bufferedDataY.size() <= thread_num) { m_bufferedDataY.resize(thread_num + 1, nullptr); for (auto &data : m_bufferedDataY) { @@ -69,7 +67,7 @@ void EventWorkspaceMRU::ensureEnoughBuffersY(size_t thread_num) const { //--------------------------------------------------------------------------- /// Clear all the data in the MRU buffers void EventWorkspaceMRU::clear() { - Mutex::ScopedLock _lock(this->m_toDeleteMutex); + Mantid::Kernel::LockGuardMutex _lock(this->m_toDeleteMutex); // FIXME: don't clear the locked ones! for (auto &marker : m_markersToDelete) @@ -98,7 +96,7 @@ void EventWorkspaceMRU::clear() { *found. */ MantidVecWithMarker *EventWorkspaceMRU::findY(size_t thread_num, size_t index) { - Mutex::ScopedLock _lock(m_changeMruListsMutexY); + Mantid::Kernel::LockGuardMutex _lock(m_changeMruListsMutexY); return m_bufferedDataY[thread_num]->find(index); } @@ -110,7 +108,7 @@ MantidVecWithMarker *EventWorkspaceMRU::findY(size_t thread_num, size_t index) { *found. */ MantidVecWithMarker *EventWorkspaceMRU::findE(size_t thread_num, size_t index) { - Mutex::ScopedLock _lock(m_changeMruListsMutexE); + Mantid::Kernel::LockGuardMutex _lock(m_changeMruListsMutexE); return m_bufferedDataE[thread_num]->find(index); } @@ -122,12 +120,12 @@ MantidVecWithMarker *EventWorkspaceMRU::findE(size_t thread_num, size_t index) { *needs to be deleted. */ void EventWorkspaceMRU::insertY(size_t thread_num, MantidVecWithMarker *data) { - Mutex::ScopedLock _lock(m_changeMruListsMutexY); + Mantid::Kernel::LockGuardMutex _lock(m_changeMruListsMutexY); MantidVecWithMarker *oldData = m_bufferedDataY[thread_num]->insert(data); // And clear up the memory of the old one, if it is dropping out. if (oldData) { if (oldData->m_locked) { - Mutex::ScopedLock _lock(this->m_toDeleteMutex); + Mantid::Kernel::LockGuardMutex _lock(this->m_toDeleteMutex); m_markersToDelete.push_back(oldData); } else delete oldData; @@ -142,12 +140,12 @@ void EventWorkspaceMRU::insertY(size_t thread_num, MantidVecWithMarker *data) { *needs to be deleted. */ void EventWorkspaceMRU::insertE(size_t thread_num, MantidVecWithMarker *data) { - Mutex::ScopedLock _lock(m_changeMruListsMutexE); + Mantid::Kernel::LockGuardMutex _lock(m_changeMruListsMutexE); MantidVecWithMarker *oldData = m_bufferedDataE[thread_num]->insert(data); // And clear up the memory of the old one, if it is dropping out. if (oldData) { if (oldData->m_locked) { - Mutex::ScopedLock _lock(this->m_toDeleteMutex); + Mantid::Kernel::LockGuardMutex _lock(this->m_toDeleteMutex); m_markersToDelete.push_back(oldData); } else delete oldData; @@ -159,11 +157,11 @@ void EventWorkspaceMRU::insertE(size_t thread_num, MantidVecWithMarker *data) { * @param index :: index to delete. */ void EventWorkspaceMRU::deleteIndex(size_t index) { - Mutex::ScopedLock _lock1(m_changeMruListsMutexE); + Mantid::Kernel::LockGuardMutex _lock1(m_changeMruListsMutexE); for (auto &data : m_bufferedDataE) if (data) data->deleteIndex(index); - Mutex::ScopedLock _lock2(m_changeMruListsMutexY); + Mantid::Kernel::LockGuardMutex _lock2(m_changeMruListsMutexY); for (auto &data : m_bufferedDataY) if (data) data->deleteIndex(index); diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index a286997ae9e541f9ced26fafa6565d9cdee51fea..eadb912c98b888dcb8628865adc92382e161c1ee 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -4,8 +4,6 @@ #include "MantidKernel/ConfigService.h" #include "MantidKernel/Exception.h" -#include <Poco/Mutex.h> - #include <boost/variant/get.hpp> using namespace Mantid::Kernel;