• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# sleep.h
2
3<!--Kit: Function Flow Runtime Kit-->
4<!--Subsystem: Resourceschedule-->
5<!--Owner: @chuchihtung; @yanleo-->
6<!--Designer: @geoffrey_guo; @huangyouzhong-->
7<!--Tester: @lotsof; @sunxuhao-->
8<!--Adviser: @foryourself-->
9
10## Overview
11
12The **sleep.h** file declares the sleep and yield APIs in C.
13
14**File to include**: <ffrt/sleep.h>
15
16**Library**: libffrt.z.so
17
18**System capability**: SystemCapability.Resourceschedule.Ffrt.Core
19
20**Since**: 10
21
22**Related module**: [FFRT](capi-ffrt.md)
23
24## Summary
25
26### Function
27
28| Name| Description|
29| -- | -- |
30| [FFRT_C_API int ffrt_usleep(uint64_t usec)](#ffrt_usleep) | Sets the fixed sleep time.|
31| [FFRT_C_API void ffrt_yield(void)](#ffrt_yield) | Passes control to other tasks so that they can be executed.|
32
33## Function Description
34
35### ffrt_usleep()
36
37```
38FFRT_C_API int ffrt_usleep(uint64_t usec)
39```
40
41**Description**
42
43Sets the fixed sleep time.
44
45**Since**: 10
46
47
48**Parameters**
49
50| Name| Description|
51| -- | -- |
52| uint64_t usec | Sleep time, in microseconds.|
53
54**Returns**
55
56| Type| Description|
57| -- | -- |
58| FFRT_C_API int | Returns **ffrt_success** if the sleep time is set;<br>          returns **ffrt_error** otherwise.|
59
60### ffrt_yield()
61
62```
63FFRT_C_API void ffrt_yield(void)
64```
65
66**Description**
67
68Passes control to other tasks so that they can be executed.
69
70**Since**: 10
71