SafeThread: Simplify m_lock assignment. (#49)

Instead of construct-and-swap, just use the move operator=.
This commit is contained in:
Peter Johnson
2017-11-12 20:10:55 -08:00
committed by GitHub
parent f77fd1eca9
commit c9ead29f44

View File

@@ -34,7 +34,7 @@ class SafeThreadProxyBase {
public:
SafeThreadProxyBase(SafeThread* thr) : m_thread(thr) {
if (!m_thread) return;
std::unique_lock<std::mutex>(m_thread->m_mutex).swap(m_lock);
m_lock = std::unique_lock<std::mutex>(m_thread->m_mutex);
if (!m_thread->m_active) {
m_lock.unlock();
m_thread = nullptr;