forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WriteLock.cpp
31 lines (27 loc) · 923 Bytes
/
WriteLock.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidKernel/WriteLock.h"
#include "MantidKernel/DataItem.h"
#include <Poco/RWLock.h>
namespace Mantid {
namespace Kernel {
//----------------------------------------------------------------------------------------------
/** Constructor
*/
WriteLock::WriteLock(const DataItem &item) : m_item(item) {
// Acquire a write lock.
m_item.m_lock->writeLock();
}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
WriteLock::~WriteLock() {
// Unlock
m_item.m_lock->unlock();
}
} // namespace Kernel
} // namespace Mantid