1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @addtogroup Ffrt
18 * @{
19 *
20 * @brief ffrt provides APIs.
21 *
22 *
23 * @syscap SystemCapability.Resourceschedule.Ffrt.Core
24 *
25 * @since 10
26 */
27
28/**
29 * @file sleep.h
30 * @kit FunctionFlowRuntimeKit
31 *
32 * @brief Declares the sleep and yield interfaces in C.
33 *
34 * @syscap SystemCapability.Resourceschedule.Ffrt.Core
35 * @since 10
36 * @version 1.0
37 */
38#ifndef FFRT_API_C_SLEEP_H
39#define FFRT_API_C_SLEEP_H
40#include <stdint.h>
41#include "type_def.h"
42
43/**
44 * @brief Suspends the calling thread for a given duration.
45 *
46 * @param usec Indicates the duration that the calling thread is suspended, in microseconds.
47 * @return Returns <b>ffrt_thrd_success</b> if the thread is suspended;
48           returns <b>ffrt_thrd_error</b> otherwise.
49 * @since 10
50 * @version 1.0
51 */
52FFRT_C_API int ffrt_usleep(uint64_t usec);
53
54/**
55 * @brief Passes control to other tasks so that they can be executed.
56 *
57 * @since 10
58 * @version 1.0
59 */
60FFRT_C_API void ffrt_yield(void);
61#endif
62