|
#pragma once
template <typename lock_t>
class ref_shared_lock_t
{
public:
ref_shared_lock_t(lock_t& lock) : m_lock(lock)
{
m_lock.acquireLockShared();
}
~ref_shared_lock_t()
{
m_lock.releaseLockShared();
}
private:
lock_t& m_lock;
ref_shared_lock_t& operator=(const ref_shared_lock_t&); //C4512 warning
};
template <typename lock_t>
class ref_exclusive_lock_t
{
public:
ref_exclusive_lock_t(lock_t& lock) : m_lock(lock)
{
m_lock.acquireLockExclusive();
}
~ref_exclusive_lock_t()
{
m_lock.releaseLockExclusive();
}
private:
lock_t& m_lock;
ref_exclusive_lock_t& operator=(const ref_exclusive_lock_t&); //C4512 warning
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.