RDK Documentation (Open Sourced RDK Components)
AampMutex.h
Go to the documentation of this file.
1
/*
2
* If not stated otherwise in this file or this component's license file the
3
* following copyright and licenses apply:
4
*
5
* Copyright 2018 RDK Management
6
*
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
18
*/
19
20
/**
21
* @file AampMutex.h
22
* @brief Helper class for scoped mutex lock
23
*/
24
25
#ifndef _AAMP_MUTEX_H
26
#define _AAMP_MUTEX_H
27
28
#include <pthread.h>
29
30
/**
31
* @class AampMutexHold
32
* @brief auto Lock the provided mutex during the object scope
33
*/
34
class
AampMutexHold
35
{
36
pthread_mutex_t& mutex_;
37
public
:
38
AampMutexHold
(pthread_mutex_t& mutex): mutex_(mutex)
39
{
40
pthread_mutex_lock(&mutex_);
41
}
42
43
~
AampMutexHold
()
44
{
45
pthread_mutex_unlock(&mutex_);
46
}
47
};
48
49
#endif //_AAMP_MUTEX_H
AampMutexHold
auto Lock the provided mutex during the object scope
Definition:
AampMutex.h:34
components
generic
aamp
AampMutex.h
Generated on Thu Feb 9 2023 06:32:27 for RDK Documentation (Open Sourced RDK Components) by
1.8.17