Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "adiag_lock.h"
12 :
13 : /**
14 : * @brief initial lock
15 : * @param [in] lock: lock pointer
16 : * @return AdiagStatus
17 : */
18 7450 : AdiagStatus AdiagLockInit(AdiagLock *lock)
19 : {
20 7450 : return (mmMutexInit(lock) == EN_OK) ? ADIAG_SUCCESS : ADIAG_FAILURE;
21 : }
22 :
23 : /**
24 : * @brief destroy lock
25 : * @param [in] lock: lock pointer
26 : * @return AdiagStatus
27 : */
28 5785 : AdiagStatus AdiagLockDestroy(AdiagLock *lock)
29 : {
30 5785 : return (mmMutexDestroy(lock) == EN_OK) ? ADIAG_SUCCESS : ADIAG_FAILURE;
31 : }
32 :
33 : /**
34 : * @brief lock
35 : * @param [in] lock: lock pointer
36 : * @return AdiagStatus
37 : */
38 3360675 : AdiagStatus AdiagLockGet(AdiagLock *lock)
39 : {
40 3360675 : return (mmMutexLock(lock) == EN_OK) ? ADIAG_SUCCESS : ADIAG_FAILURE;
41 : }
42 :
43 : /**
44 : * @brief unlock
45 : * @param [in] lock: lock pointer
46 : * @return AdiagStatus
47 : */
48 3360677 : AdiagStatus AdiagLockRelease(AdiagLock *lock)
49 : {
50 3360677 : return (mmMutexUnLock(lock) == EN_OK) ? ADIAG_SUCCESS : ADIAG_FAILURE;
51 : }
52 :
|