1484543d1Sopenharmony_ci/* 2484543d1Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3484543d1Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4484543d1Sopenharmony_ci * you may not use this file except in compliance with the License. 5484543d1Sopenharmony_ci * You may obtain a copy of the License at 6484543d1Sopenharmony_ci * 7484543d1Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8484543d1Sopenharmony_ci * 9484543d1Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10484543d1Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11484543d1Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12484543d1Sopenharmony_ci * See the License for the specific language governing permissions and 13484543d1Sopenharmony_ci * limitations under the License. 14484543d1Sopenharmony_ci */ 15484543d1Sopenharmony_ci 16484543d1Sopenharmony_ci/** 17484543d1Sopenharmony_ci * @addtogroup Ffrt 18484543d1Sopenharmony_ci * @{ 19484543d1Sopenharmony_ci * 20484543d1Sopenharmony_ci * @brief ffrt provides APIs. 21484543d1Sopenharmony_ci * 22484543d1Sopenharmony_ci * 23484543d1Sopenharmony_ci * @syscap SystemCapability.Resourceschedule.Ffrt.Core 24484543d1Sopenharmony_ci * 25484543d1Sopenharmony_ci * @since 10 26484543d1Sopenharmony_ci */ 27484543d1Sopenharmony_ci 28484543d1Sopenharmony_ci/** 29484543d1Sopenharmony_ci * @file sleep.h 30484543d1Sopenharmony_ci * 31484543d1Sopenharmony_ci * @brief Declares the sleep and yield interfaces in C. 32484543d1Sopenharmony_ci * 33484543d1Sopenharmony_ci * @syscap SystemCapability.Resourceschedule.Ffrt.Core 34484543d1Sopenharmony_ci * @since 10 35484543d1Sopenharmony_ci * @version 1.0 36484543d1Sopenharmony_ci */ 37484543d1Sopenharmony_ci#ifndef FFRT_API_C_SLEEP_H 38484543d1Sopenharmony_ci#define FFRT_API_C_SLEEP_H 39484543d1Sopenharmony_ci#include <stdint.h> 40484543d1Sopenharmony_ci#include "type_def.h" 41484543d1Sopenharmony_ci 42484543d1Sopenharmony_ci/** 43484543d1Sopenharmony_ci * @brief Suspends the calling thread for a given duration. 44484543d1Sopenharmony_ci * 45484543d1Sopenharmony_ci * @param usec Indicates the duration that the calling thread is suspended, in microseconds. 46484543d1Sopenharmony_ci * @return Returns <b>ffrt_thrd_success</b> if the thread is suspended; 47484543d1Sopenharmony_ci returns <b>ffrt_thrd_error</b> otherwise. 48484543d1Sopenharmony_ci * @since 10 49484543d1Sopenharmony_ci * @version 1.0 50484543d1Sopenharmony_ci */ 51484543d1Sopenharmony_ciFFRT_C_API int ffrt_usleep(uint64_t usec); 52484543d1Sopenharmony_ci 53484543d1Sopenharmony_ci/** 54484543d1Sopenharmony_ci * @brief Passes control to other tasks so that they can be executed. 55484543d1Sopenharmony_ci * 56484543d1Sopenharmony_ci * @since 10 57484543d1Sopenharmony_ci * @version 1.0 58484543d1Sopenharmony_ci */ 59484543d1Sopenharmony_ciFFRT_C_API void ffrt_yield(void); 60484543d1Sopenharmony_ci#endif 61