UINT32 LOS_MuxPend ( UINT32  uwMuxHandle,
UINT32  uwTimeout  
)

Wait to lock a mutex.

Description:
This API is used to wait for a specified period of time to lock a mutex.
注意:
  • The specific mutex should be created firstly.
  • The function fails if the mutex that is waited on is already locked by another thread when the task scheduling is disabled.
  • Do not wait on a mutex during an interrupt.
  • The priority inheritance protocol is supported. If a higher-priority thread is waiting on a mutex, it changes the priority of the thread that owns the mutex to avoid priority inversion.
  • A recursive mutex can be locked more than once by the same thread.
参数:
参数名称 描述
uwMuxHandle  [IN] Handle of the mutex to be waited on. The value of handle should be in [0, LOSCFG_BASE_IPC_MUX_LIMIT - 1].
uwTimeout  [IN] Waiting time. The value range is [0, LOS_WAIT_FOREVER](unit: Tick).
返回值:
返回值 描述
LOS_ERRNO_MUX_INVALID  The mutex state (for example, the mutex does not exist or is not in use) is not applicable for the current operation.
LOS_ERRNO_MUX_UNAVAILABLE  The mutex fails to be locked because it is locked by another thread and a period of time is not set for waiting for the mutex to become available.
LOS_ERRNO_MUX_PEND_INTERR  The mutex is being locked during an interrupt.
LOS_ERRNO_MUX_PEND_IN_LOCK  The mutex is waited on when the task scheduling is disabled.
LOS_ERRNO_MUX_TIMEOUT  The mutex waiting times out.
LOS_OK  The mutex is successfully locked.
Dependency:
  • los_mux.h: the header file that contains the API declaration.
参见:
LOS_MuxCreate | LOS_MuxPost
自从:
Huawei LiteOS V100R001C00