pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
lock.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_LOCK_H
4#define pRC_CORE_BASIC_LOCK_H
5
6#include <mutex>
7
8namespace pRC
9{
10 using Mutex = std::mutex;
11
12 template<class Mutex>
13 class Lock
14 {
15 public:
16 explicit Lock(Mutex &mutex)
17 : mMutex(mutex)
18 {
19 mMutex.lock();
20 }
21
23 {
24 mMutex.unlock();
25 }
26
27 Lock(Lock const &) = delete;
28 Lock &operator=(Lock const &) = delete;
29
30 private:
31 Mutex &mMutex;
32 };
33}
34#endif // pRC_CORE_BASIC_LOCK_H
Definition lock.hpp:14
Lock & operator=(Lock const &)=delete
Lock(Lock const &)=delete
Lock(Mutex &mutex)
Definition lock.hpp:16
~Lock()
Definition lock.hpp:22
Definition cholesky.hpp:18
std::mutex Mutex
Definition lock.hpp:10
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13