Line data Source code
1 : /**
2 : * Copyright (c) 2026 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 "hcomm/hcomm_exception.h"
12 : #include "exception_callback_mgr.h"
13 : #include "log.h"
14 :
15 8 : int32_t HcommExceptionRegisterCallback(HcommExceptionCallback cb, void* userData)
16 : {
17 8 : HcclResult ret = hcomm::ExceptionCallbackMgr::GetInstance().Register(cb, userData);
18 8 : if (ret != HCCL_SUCCESS) {
19 1 : HCCL_ERROR("[%s] register fail, ret[%d]", __func__, ret);
20 : }
21 8 : return static_cast<int32_t>(ret);
22 : }
23 :
24 10 : int32_t HcommExceptionUnregisterCallback(HcommExceptionCallback cb)
25 : {
26 10 : HcclResult ret = hcomm::ExceptionCallbackMgr::GetInstance().Unregister(cb);
27 10 : if (ret != HCCL_SUCCESS) {
28 1 : HCCL_ERROR("[%s] unregister fail, ret[%d]", __func__, ret);
29 : }
30 10 : return static_cast<int32_t>(ret);
31 : }
|