UINT32 LOS_TaskDelay ( UINT32  uwTick  ) 

Delay a task.

Description:
This API is used to delay the execution of the current task. The task is able to be scheduled after it is delayed for a specified number of Ticks.
注意:
  • The task fails to be delayed if it is being delayed during interrupt processing or it is locked.
  • If 0 is passed in and the task scheduling is not locked, execute the next task in the queue of tasks with the same priority of the current task. If no ready task with the priority of the current task is available, the task scheduling will not occur, and the current task continues to be executed.
  • Using the interface before system initialized is not allowed.
参数:
参数名称 描述
uwTick  [IN] Type UINT32 Number of Ticks for which the task is delayed.
返回值:
返回值 描述
LOS_ERRNO_TSK_DELAY_IN_INT  The task delay occurs during an interrupt.
LOS_ERRNO_TSK_DELAY_IN_LOCK  The task delay occurs when the task scheduling is locked.
LOS_ERRNO_TSK_ID_INVALID  Invalid Task ID
LOS_ERRNO_TSK_YIELD_NOT_ENOUGH_TASK  No tasks with the same priority is available for scheduling.
LOS_OK  The task is successfully delayed.
Dependency:
  • los_task.h: the header file that contains the API declaration.
参见:
自从:
Huawei LiteOS V100R001C00