Mantid
Loading...
Searching...
No Matches
WriteLock.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#include <Poco/RWLock.h>
10
11namespace Mantid::Kernel {
12
13//----------------------------------------------------------------------------------------------
16WriteLock::WriteLock(const DataItem &item) : m_item(item) {
17 // Acquire a write lock.
18 m_item.m_lock->writeLock();
19}
20
21//----------------------------------------------------------------------------------------------
25 // Unlock
26 m_item.m_lock->unlock();
27}
28
29} // 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
WriteLock(const DataItem &item)
Constructor.
Definition: WriteLock.cpp:16
const DataItem & m_item
Reference to the data item we are locking.
Definition: WriteLock.h:55
virtual ~WriteLock()
Destructor.
Definition: WriteLock.cpp:24