Derecho  0.9
Distributed systems toolkit for RDMA
locked_reference.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <mutex>
10 
11 namespace derecho {
12 
19 template <typename LockType, typename T>
21 private:
23  LockType lock;
24 
25 public:
26  LockedReference(T& real_reference, typename LockType::mutex_type& mutex)
27  : reference(real_reference), lock(mutex) {}
28 
29  T& get() {
30  return reference;
31  }
32 };
33 } // namespace derecho
A little helper class that wraps together a reference and a lock on a related mutex.
LockedReference(T &real_reference, typename LockType::mutex_type &mutex)