CPPMyth
Library to interoperate with MythTV server
mythlocked.cpp
1 /*
2  * Copyright (C) 2015 Jean-Luc Barriere
3  *
4  * This Program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  * This Program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; see the file COPYING. If not, write to
16  * the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
17  * MA 02110-1301 USA
18  * http://www.gnu.org/copyleft/gpl.html
19  *
20  */
21 
22 #include "mythlocked.h"
23 #include "private/os/threads/mutex.h"
24 
25 using namespace Myth;
26 
27 namespace Myth
28 {
30  {
31  OS::CMutex mutex;
32  };
33 }
34 
36 : m_lock(lock)
37 {
38  m_lock->mutex.Lock();
39 }
40 
41 LockGuard::~LockGuard()
42 {
43  m_lock->mutex.Unlock();
44 }
45 
47 {
48  return new Lockable();
49 }
50 
52 {
53  delete lock;
54 }
55 
57 {
58  lock->mutex.Lock();
59 }
60 
62 {
63  lock->mutex.Unlock();
64 }
65 
67 {
68  lock->mutex.Clear();
69 }
static void Lock(Lockable *lock)
Definition: mythlocked.cpp:56
static void DestroyLock(Lockable *lock)
Definition: mythlocked.cpp:51
static void ClearLock(Lockable *lock)
Definition: mythlocked.cpp:66
static Lockable * CreateLock()
Definition: mythlocked.cpp:46
static void Unlock(Lockable *lock)
Definition: mythlocked.cpp:61
LockGuard(Lockable *lock)
Definition: mythlocked.cpp:35
This is the main namespace that encloses all public classes.
Definition: mythcontrol.h:29