结构体 | |
struct | LosSemCB |
函数 | |
UINT32 | LOS_SemCreate (UINT16 count, UINT32 *semHandle) |
Create a semaphore. 更多... | |
UINT32 | LOS_BinarySemCreate (UINT16 count, UINT32 *semHandle) |
Create a binary semaphore. 更多... | |
UINT32 | LOS_SemDelete (UINT32 semHandle) |
Delete a semaphore. 更多... | |
UINT32 | LOS_SemPend (UINT32 semHandle, UINT32 timeout) |
Request a semaphore. 更多... | |
UINT32 | LOS_SemPost (UINT32 semHandle) |
Release a semaphore. 更多... | |
Create a binary semaphore.
count | [IN] Initial number of available semaphores. The value range is [0, 1]. |
semHandle | [OUT] ID of the semaphore control structure that is initialized. |
#LOS_ERRNO_SEM_PTR_NULL | The passed-in semHandle value is NULL. |
#LOS_ERRNO_SEM_OVERFLOW | The passed-in count value is greater than the maximum number of available semaphores. |
#LOS_ERRNO_SEM_ALL_BUSY | No semaphore control structure is available. |
#LOS_OK | The semaphore is successfully created. |
Create a binary semaphore.
Create a semaphore.
count | [IN] Initial number of available semaphores. The value range is [0, OS_SEM_COUNT_MAX]. |
semHandle | [OUT] ID of the semaphore control structure that is initialized. |
#LOS_ERRNO_SEM_PTR_NULL | The passed-in semHandle value is NULL. |
#LOS_ERRNO_SEM_OVERFLOW | The passed-in count value is greater than the maximum number of available semaphores. |
#LOS_ERRNO_SEM_ALL_BUSY | No semaphore control structure is available. |
#LOS_OK | The semaphore is successfully created. |
Create a semaphore.
Delete a semaphore.
semHandle | [IN] ID of the semaphore control structure to be deleted. The ID of the semaphore control structure is obtained from semaphore creation. |
#LOS_ERRNO_SEM_INVALID | The passed-in semHandle value is invalid. |
#LOS_ERRNO_SEM_PENDED | The queue of the tasks that are waiting on the semaphore control structure is not null. |
#LOS_OK | The semaphore control structure is successfully deleted. |
Delete a semaphore.
Request a semaphore.
semHandle | [IN] ID of the semaphore control structure to be requested. The ID of the semaphore control structure is obtained from semaphore creation. |
timeout | [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 semHandle 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. |
Request a semaphore.
Release a semaphore.
semHandle | [IN] ID of the semaphore control structure to be released.The ID of the semaphore control structure is obtained from semaphore creation. |
#LOS_ERRNO_SEM_INVALID | The passed-in semHandle value is invalid. |
#LOS_ERRNO_SEM_OVERFLOW | The times of semaphore release exceed the maximum times permitted. |
#LOS_OK | The semaphore is successfully released. |
Release a semaphore.