Plasma Engine  2.0
Loading...
Searching...
No Matches
Lock.h
1#pragma once
2
4template <typename T>
5class plLock
6{
7public:
8 PL_ALWAYS_INLINE explicit plLock(T& ref_lock)
9 : m_Lock(ref_lock)
10 {
11 m_Lock.Lock();
12 }
13
14 PL_ALWAYS_INLINE ~plLock() { m_Lock.Unlock(); }
15
16private:
17 plLock();
18 plLock(const plLock<T>& rhs);
19 void operator=(const plLock<T>& rhs);
20
21 T& m_Lock;
22};
23
25#define PL_LOCK(lock) plLock<decltype(lock)> PL_PP_CONCAT(l_, PL_SOURCE_LINE)(lock)
Manages a lock (e.g. a mutex) and ensures that it is properly released as the lock object goes out of...
Definition Lock.h:6