forked from boostorg/unordered
explicitly declared guards' copy ctors as it prevents VS from doing spurious copies (!)
This commit is contained in:
@ -106,6 +106,9 @@ public:
|
|||||||
shared_lock(Mutex& m_)noexcept:m{m_}{m.lock_shared();}
|
shared_lock(Mutex& m_)noexcept:m{m_}{m.lock_shared();}
|
||||||
~shared_lock()noexcept{if(owns)m.unlock_shared();}
|
~shared_lock()noexcept{if(owns)m.unlock_shared();}
|
||||||
|
|
||||||
|
/* not used but VS in pre-C++17 mode needs to see it for RVO */
|
||||||
|
shared_lock(const shared_lock&);
|
||||||
|
|
||||||
void lock(){BOOST_ASSERT(!owns);m.lock_shared();owns=true;}
|
void lock(){BOOST_ASSERT(!owns);m.lock_shared();owns=true;}
|
||||||
void unlock(){BOOST_ASSERT(owns);m.unlock_shared();owns=false;}
|
void unlock(){BOOST_ASSERT(owns);m.unlock_shared();owns=false;}
|
||||||
|
|
||||||
@ -125,6 +128,9 @@ public:
|
|||||||
lock_guard(Mutex& m_)noexcept:m{m_}{m.lock();}
|
lock_guard(Mutex& m_)noexcept:m{m_}{m.lock();}
|
||||||
~lock_guard()noexcept{m.unlock();}
|
~lock_guard()noexcept{m.unlock();}
|
||||||
|
|
||||||
|
/* not used but VS in pre-C++17 mode needs to see it for RVO */
|
||||||
|
lock_guard(const lock_guard&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex &m;
|
Mutex &m;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user