提供AliOS Things系统内核信号量功能的基础API.
◆ aos_sem_t
◆ aos_sem_create()
Alloc a semaphore.
- 参数
-
[out] | sem | pointer of semaphore object, semaphore object must be alloced, hdl pointer in aos_sem_t will refer a kernel obj internally. |
[in] | count | initial semaphore counter. |
[in] | options | reserved. |
- 返回
- 0:success.
◆ aos_sem_free()
Destroy a semaphore.
- 参数
-
[in] | sem | pointer of semaphore object, mem refered by hdl pointer in aos_sem_t will be freed internally. |
◆ aos_sem_is_valid()
This function will check if semaphore is valid. Deprecated, not Recommended.
- 参数
-
[in] | sem | pointer to the sem. |
- 返回
- false: invalid, true: valid.
◆ aos_sem_new()
Alloc a semaphore. Deprecated, not Recommended.
- 参数
-
[out] | sem | pointer of semaphore object, semaphore object must be alloced, hdl pointer in aos_sem_t will refer a kernel obj internally. |
[in] | count | initial semaphore counter. |
- 返回
- 0:success.
◆ aos_sem_signal()
Release a semaphore.
- 参数
-
[in] | sem | semaphore object, it contains kernel obj pointer which aos_sem_new alloced. |
◆ aos_sem_signal_all()
Release all semaphore.
- 参数
-
[in] | sem | semaphore object, it contains kernel obj pointer which aos_sem_new alloced. |
◆ aos_sem_wait()
Acquire a semaphore.
- 参数
-
[in] | sem | semaphore object, it contains kernel obj pointer which aos_sem_new alloced. |
[in] | timeout | waiting until timeout in milliseconds. |
- 返回
- 0: success.