1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/thread/MutexLock.h
12 #ifndef ZYPP_THREAD_MUTEXLOCK_H
13 #define ZYPP_THREAD_MUTEXLOCK_H
15 #include "zypp/thread/Mutex.h"
19 //////////////////////////////////////////////////////////////////////
21 { ////////////////////////////////////////////////////////////////////
22 ////////////////////////////////////////////////////////////////////
24 { //////////////////////////////////////////////////////////////////
27 // -------------------------------------------------------------
31 explicit MutexLock(Mutex &mutex, bool init_locked=true)
39 MutexLock(const MutexLock &ref)
40 : m_mutex( ref.m_mutex)
41 , m_locked(ref.m_locked)
55 // don't let exceptions escape
61 assert(m_locked == false);
68 assert(m_locked == true);
75 assert(m_locked == false);
76 m_locked = m_mutex->trylock();
87 mutable bool m_locked;
88 //friend class Condition;
92 //////////////////////////////////////////////////////////////////
94 ////////////////////////////////////////////////////////////////////
95 ////////////////////////////////////////////////////////////////////
97 //////////////////////////////////////////////////////////////////////
99 #endif // ZYPP_THREAD_MUTEXLOCK_H
101 ** vim: set ts=2 sts=2 sw=2 ai et: