1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Implementation Notes
19  * Each platform must supply chpp/platform/platform_mutex.h which provides the
20  * platform-specific definitions (and implementation as necessary) for the
21  * definitions in this file.
22  */
23 
24 #ifndef CHPP_MUTEX_H_
25 #define CHPP_MUTEX_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /*
32  * Platform-specific mutex struct, defined in the platform's platform_mutex.h
33  * file.
34  */
35 struct ChppMutex;
36 
37 /*
38  * Initializes a specified platform-specific mutex.
39  *
40  * @param mutex points to the ChppMutex mutex struct.
41  */
42 static void chppMutexInit(struct ChppMutex *mutex);
43 
44 /*
45  * Deinitializes a specified platform-specific mutex.
46  *
47  * @param mutex points to the ChppMutex mutex struct.
48  */
49 static void chppMutexDeinit(struct ChppMutex *mutex);
50 
51 /*
52  * Locks a specified platform-specific mutex.
53  *
54  * @param mutex points to the ChppMutex mutex struct.
55  */
56 static void chppMutexLock(struct ChppMutex *mutex);
57 
58 /*
59  * Unlocks a specified platform-specific mutex.
60  *
61  * @param mutex points to the ChppMutex mutex struct.
62  */
63 static void chppMutexUnlock(struct ChppMutex *mutex);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #include "chpp/platform/platform_mutex.h"
70 
71 #endif  // CHPP_MUTEX_H_
72