UINT32 LOS_SemPend ( UINT32  uwSemHandle,
UINT32  uwTimeout  
)

Request a semaphore.

Description:
This API is used to request a semaphore based on the semaphore control structure ID specified by uwSemHandle and the parameter that specifies the timeout period.
注意:
  • The specified sem id must be created first.
参数:
参数名称 描述
uwSemHandle  [IN] ID of the semaphore control structure to be requested. The ID of the semaphore control structure is obtained from semaphore creation.
uwTimeout  [IN] Timeout interval for waiting on the semaphore. The value range is [0, 0xFFFFFFFF]. If the value is set to 0, the semaphore is not waited on. If the value is set to 0xFFFFFFFF, the semaphore is waited on forever(unit: Tick).
返回值:
返回值 描述
LOS_ERRNO_SEM_INVALID  The passed-in uwSemHandle value is invalid.
LOS_ERRNO_SEM_UNAVAILABLE  There is no available semaphore resource.
LOS_ERRNO_SEM_PEND_INTERR  The API is called during an interrupt, which is forbidden.
LOS_ERRNO_SEM_PEND_IN_LOCK  The task is unable to request a semaphore because task scheduling is locked.
LOS_ERRNO_SEM_TIMEOUT  The request for the semaphore times out.
LOS_OK  The semaphore request succeeds.
Dependency:
  • los_sem.h: the header file that contains the API declaration.
参见:
LOS_SemPost | LOS_SemCreate
自从:
Huawei LiteOS V100R001C00