LeechCraft
0.6.70-17793-g6e56308e78
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
mutex.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <QMutex>
12
#include "
attributes.h
"
13
14
namespace
LC::Util
15
{
16
class
CAPABILITY
(
"mutex"
) Mutex
17
{
18
QMutex M_;
19
public
:
20
explicit
Mutex () =
default
;
21
22
void
lock ()
ACQUIRE
()
23
{
24
M_.lock ();
25
}
26
27
void
unlock ()
RELEASE
()
28
{
29
M_.unlock ();
30
}
31
32
QMutex& GetMutex ()
33
{
34
return
M_;
35
}
36
};
37
38
class
SCOPED_LOCKABLE
MutexLocker
final
39
{
40
Mutex& M_;
41
public
:
42
explicit
MutexLocker
(Mutex& m)
ACQUIRE
(m)
43
: M_ { m }
44
{
45
M_.lock ();
46
}
47
48
~MutexLocker
()
RELEASE
()
49
{
50
M_.unlock ();
51
}
52
};
53
}
attributes.h
RELEASE
#define RELEASE(...)
Definition
attributes.h:21
SCOPED_LOCKABLE
#define SCOPED_LOCKABLE
Definition
attributes.h:19
ACQUIRE
#define ACQUIRE(...)
Definition
attributes.h:20
LC::Util::MutexLocker::MutexLocker
MutexLocker(Mutex &m) ACQUIRE(m)
Definition
mutex.h:42
LC::Util::MutexLocker::~MutexLocker
~MutexLocker() RELEASE()
Definition
mutex.h:48
LC::Util
Definition
icoreproxy.h:34
LC::Util::CAPABILITY
class CAPABILITY("mutex") Mutex
Definition
mutex.h:16
src
util
threads
mutex.h
Generated by
1.16.1