Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET
Apache Qpid Documentation
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
qpid
management
Mutex.h
Go to the documentation of this file.
1
#ifndef _management_Mutex_h
2
#define _management_Mutex_h
3
4
/*
5
*
6
* Copyright (c) 2008 The Apache Software Foundation
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
*/
21
22
#include "
qpid/CommonImportExport.h
"
23
24
namespace
qpid {
25
namespace
sys {
26
class
Mutex;
27
}
28
29
namespace
management
{
30
35
template
<
class
L>
class
ScopedLockTemplate
{
36
public
:
37
ScopedLockTemplate
(L& l) : mutex(l) { mutex.lock(); }
38
~ScopedLockTemplate
() { mutex.unlock(); }
39
private
:
40
L& mutex;
41
};
42
43
template
<
class
L>
class
ScopedUnlockTemplate
{
44
public
:
45
ScopedUnlockTemplate
(L& l) : mutex(l) { mutex.unlock(); }
46
~ScopedUnlockTemplate
() { mutex.lock(); }
47
private
:
48
L& mutex;
49
};
50
51
class
Mutex
{
52
public
:
53
typedef
ScopedLockTemplate<Mutex>
ScopedLock
;
54
typedef
ScopedUnlockTemplate<Mutex>
ScopedUnlock
;
55
56
QPID_COMMON_EXTERN
Mutex
();
57
QPID_COMMON_EXTERN
~Mutex
();
58
QPID_COMMON_EXTERN
void
lock
();
59
QPID_COMMON_EXTERN
void
unlock
();
60
private
:
61
sys::Mutex
* impl;
62
};
63
}
64
}
65
66
#endif
67
Qpid C++ API Reference
Generated on Thu Aug 28 2014 for Qpid C++ Client API by
1.8.3.1