diff --git a/liteipc/include/liteipc_pri.h b/liteipc/include/liteipc_pri.h new file mode 100644 index 0000000000000000000000000000000000000000..fd819cece87769991ac402893313c85e7629feb8 --- /dev/null +++ b/liteipc/include/liteipc_pri.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LITEIPC_PRI_H +#define _LITEIPC_PRI_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +void ResetLiteIpc(); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif diff --git a/liteipc/src/liteipc_adapter.c b/liteipc/src/liteipc_adapter.c index 001bea1ddd7afcc917f1384efa91faf3e0693fbe..22a3cc54dc68916b1baa6fc7140fceab8762b4df 100755 --- a/liteipc/src/liteipc_adapter.c +++ b/liteipc/src/liteipc_adapter.c @@ -198,6 +198,18 @@ IpcContext* OpenLiteIpc(size_t mmapSize) return (IpcContext*)(intptr_t)(GetLiteIpcContext(mmapSize, NULL) == LITEIPC_OK); } +void ResetLiteIpc() +{ + if (g_context != NULL) { + free(g_context); + g_context = NULL; + } + pthread_mutex_init(&g_ipcContextMutex, NULL); + g_ipcCallbackCb.handleId = -1; + g_ipcCallbackCb.threadWorking = false; + pthread_mutex_init(&g_ipcCallbackCb.mutex, NULL); +} + void CloseLiteIpc(IpcContext* context) { }