17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci/** 177777dab0Sopenharmony_ci * @addtogroup Ffrt 187777dab0Sopenharmony_ci * @{ 197777dab0Sopenharmony_ci * 207777dab0Sopenharmony_ci * @brief ffrt provides APIs. 217777dab0Sopenharmony_ci * 227777dab0Sopenharmony_ci * 237777dab0Sopenharmony_ci * @syscap SystemCapability.Resourceschedule.Ffrt.Core 247777dab0Sopenharmony_ci * 257777dab0Sopenharmony_ci * @since 10 267777dab0Sopenharmony_ci */ 277777dab0Sopenharmony_ci 287777dab0Sopenharmony_ci/** 297777dab0Sopenharmony_ci * @file sleep.h 307777dab0Sopenharmony_ci * @kit FunctionFlowRuntimeKit 317777dab0Sopenharmony_ci * 327777dab0Sopenharmony_ci * @brief Declares the sleep and yield interfaces in C. 337777dab0Sopenharmony_ci * 347777dab0Sopenharmony_ci * @syscap SystemCapability.Resourceschedule.Ffrt.Core 357777dab0Sopenharmony_ci * @since 10 367777dab0Sopenharmony_ci * @version 1.0 377777dab0Sopenharmony_ci */ 387777dab0Sopenharmony_ci#ifndef FFRT_API_C_SLEEP_H 397777dab0Sopenharmony_ci#define FFRT_API_C_SLEEP_H 407777dab0Sopenharmony_ci#include <stdint.h> 417777dab0Sopenharmony_ci#include "type_def.h" 427777dab0Sopenharmony_ci 437777dab0Sopenharmony_ci/** 447777dab0Sopenharmony_ci * @brief Suspends the calling thread for a given duration. 457777dab0Sopenharmony_ci * 467777dab0Sopenharmony_ci * @param usec Indicates the duration that the calling thread is suspended, in microseconds. 477777dab0Sopenharmony_ci * @return Returns <b>ffrt_thrd_success</b> if the thread is suspended; 487777dab0Sopenharmony_ci returns <b>ffrt_thrd_error</b> otherwise. 497777dab0Sopenharmony_ci * @since 10 507777dab0Sopenharmony_ci * @version 1.0 517777dab0Sopenharmony_ci */ 527777dab0Sopenharmony_ciFFRT_C_API int ffrt_usleep(uint64_t usec); 537777dab0Sopenharmony_ci 547777dab0Sopenharmony_ci/** 557777dab0Sopenharmony_ci * @brief Passes control to other tasks so that they can be executed. 567777dab0Sopenharmony_ci * 577777dab0Sopenharmony_ci * @since 10 587777dab0Sopenharmony_ci * @version 1.0 597777dab0Sopenharmony_ci */ 607777dab0Sopenharmony_ciFFRT_C_API void ffrt_yield(void); 617777dab0Sopenharmony_ci#endif 62