1060ff233Sopenharmony_ci/* 2060ff233Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3060ff233Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4060ff233Sopenharmony_ci * you may not use this file except in compliance with the License. 5060ff233Sopenharmony_ci * You may obtain a copy of the License at 6060ff233Sopenharmony_ci * 7060ff233Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8060ff233Sopenharmony_ci * 9060ff233Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10060ff233Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11060ff233Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12060ff233Sopenharmony_ci * See the License for the specific language governing permissions and 13060ff233Sopenharmony_ci * limitations under the License. 14060ff233Sopenharmony_ci */ 15060ff233Sopenharmony_ci 16060ff233Sopenharmony_ci#ifndef SOFTBUS_ADAPTER_XCOLLIE_H 17060ff233Sopenharmony_ci#define SOFTBUS_ADAPTER_XCOLLIE_H 18060ff233Sopenharmony_ci 19060ff233Sopenharmony_ci#include <stdint.h> 20060ff233Sopenharmony_ci 21060ff233Sopenharmony_ci#ifdef __cplusplus 22060ff233Sopenharmony_ci#if __cplusplus 23060ff233Sopenharmony_ciextern "C" { 24060ff233Sopenharmony_ci#endif 25060ff233Sopenharmony_ci#endif 26060ff233Sopenharmony_ci 27060ff233Sopenharmony_ci/** 28060ff233Sopenharmony_ci* @brief Called when set timer for service watchdog. 29060ff233Sopenharmony_ci* @param name Indicates the point to the name of the timer. 30060ff233Sopenharmony_ci* @param timeout Indicates the timeout. 31060ff233Sopenharmony_ci* @param func Indicates the point to the callback function. 32060ff233Sopenharmony_ci* @param args Indicates the point to the timer timeout operation. 33060ff233Sopenharmony_ci* 34060ff233Sopenharmony_ci* @return Return the timer id. 35060ff233Sopenharmony_ci* 36060ff233Sopenharmony_ci* @since 1.0 37060ff233Sopenharmony_ci* @version 1.0 38060ff233Sopenharmony_ci*/ 39060ff233Sopenharmony_ciint32_t SoftBusSetWatchdogTimer(const char *name, uint32_t timeout, void(*func)(void*), void *args); 40060ff233Sopenharmony_ci 41060ff233Sopenharmony_ci/** 42060ff233Sopenharmony_ci* @brief Called when cancel timer of service watchdog. 43060ff233Sopenharmony_ci* @param id Indicates the id of the timer. 44060ff233Sopenharmony_ci* 45060ff233Sopenharmony_ci* @since 1.0 46060ff233Sopenharmony_ci* @version 1.0 47060ff233Sopenharmony_ci*/ 48060ff233Sopenharmony_civoid SoftBusCancelWatchdogTimer(int32_t id); 49060ff233Sopenharmony_ci 50060ff233Sopenharmony_ci/** 51060ff233Sopenharmony_ci* @brief Called when run a onshot task in shared watchdog thread, the submitted task should never be time consuming. 52060ff233Sopenharmony_ci* @param name Indicates the point to the name of the task. 53060ff233Sopenharmony_ci* @param task Indicates the point to a short function name. 54060ff233Sopenharmony_ci* @param delay Indicates delay a few millisecond to run the task. 55060ff233Sopenharmony_ci* 56060ff233Sopenharmony_ci* @since 1.0 57060ff233Sopenharmony_ci* @version 1.0 58060ff233Sopenharmony_ci*/ 59060ff233Sopenharmony_civoid SoftBusRunOneShotTask(const char *name, void(*task)(void), uint64_t delay); 60060ff233Sopenharmony_ci 61060ff233Sopenharmony_ci/** 62060ff233Sopenharmony_ci* @brief Called when run a periodical task in shared watchdog thread. 63060ff233Sopenharmony_ci* @param name Indicates the point to the name of the task. 64060ff233Sopenharmony_ci* @param task Indicates the point to a short function name. 65060ff233Sopenharmony_ci* @param interval Indicates the millisecond interval of the periodical task. 66060ff233Sopenharmony_ci* @param delay Indicates delay a few millisecond to first run the task. 67060ff233Sopenharmony_ci* 68060ff233Sopenharmony_ci* @since 1.0 69060ff233Sopenharmony_ci* @version 1.0 70060ff233Sopenharmony_ci*/ 71060ff233Sopenharmony_civoid SoftBusRunPeriodicalTask(const char *name, void(*task)(void), uint64_t interval, uint64_t delay); 72060ff233Sopenharmony_ci 73060ff233Sopenharmony_ci#ifdef __cplusplus 74060ff233Sopenharmony_ci#if __cplusplus 75060ff233Sopenharmony_ci} 76060ff233Sopenharmony_ci#endif /* __cplusplus */ 77060ff233Sopenharmony_ci#endif /* __cplusplus */ 78060ff233Sopenharmony_ci 79060ff233Sopenharmony_ci#endif // SOFTBUS_ADAPTER_XCOLLIE_H 80