Mantid
Loading...
Searching...
No Matches
DataItem.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 +
7//-----------------------------------------------------------------------------
8// Includes
9//-----------------------------------------------------------------------------
11#include <Poco/RWLock.h>
12
13namespace Mantid::Kernel {
14
17DataItem::DataItem() : m_lock(std::make_unique<Poco::RWLock>()) {}
18
22DataItem::DataItem(const DataItem & /*other*/) : m_lock(std::make_unique<Poco::RWLock>()) {}
23
28DataItem::~DataItem() = default;
29
30void DataItem::readLock() { getLock()->readLock(); }
31void DataItem::unlock() { getLock()->unlock(); }
32
37Poco::RWLock *DataItem::getLock() const { return m_lock.get(); }
38
39} // 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
Poco::RWLock * getLock() const
Private method to access the RWLock object.
Definition: DataItem.cpp:37
void readLock()
Acquires a read lock.
Definition: DataItem.cpp:30
virtual ~DataItem()
Destructor.
DataItem()
Default constructor.
Definition: DataItem.cpp:17
std::unique_ptr< Poco::RWLock > m_lock
Multiple-reader/single-writer lock to restrict multithreaded access to the data item.
Definition: DataItem.h:68
Definition: Algorithm.h:30
STL namespace.