Mantid
Loading...
Searching...
No Matches
ReadLock.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9
10#include <Poco/RWLock.h>
11
12namespace Mantid::Kernel {
13
14//----------------------------------------------------------------------------------------------
17ReadLock::ReadLock(const DataItem &item) : m_item(item) {
18 // Acquire a read lock.
19 m_item.m_lock->readLock();
20}
21
22//----------------------------------------------------------------------------------------------
26 // Unlock
27 m_item.m_lock->unlock();
28}
29
30} // namespace Mantid::Kernel
This class forms the base class of any item that wishes to be stored in the analysis data service.
Definition: DataItem.h:39
std::unique_ptr< Poco::RWLock > m_lock
Multiple-reader/single-writer lock to restrict multithreaded access to the data item.
Definition: DataItem.h:68
virtual ~ReadLock()
Destructor.
Definition: ReadLock.cpp:25
ReadLock(const DataItem &item)
Constructor.
Definition: ReadLock.cpp:17
const DataItem & m_item
Reference to the data item we are locking.
Definition: ReadLock.h:51