Files | |
file | sem.c |
This file is part of the RTAI project. | |
Functions | |
int | rt_sem_create (RT_SEM *sem, const char *name, unsigned long icount, int mode) |
Create a counting semaphore. | |
int | rt_sem_delete (RT_SEM *sem) |
Delete a semaphore. | |
int | rt_sem_p (RT_SEM *sem, RTIME timeout) |
Pend on a semaphore. | |
int | rt_sem_v (RT_SEM *sem) |
Signal a semaphore. | |
int | rt_sem_inquire (RT_SEM *sem, RT_SEM_INFO *info) |
Inquire about a semaphore. |
|
Create a counting semaphore.
Context: This routine can be called on behalf of a task or from the initialization code. |
|
Delete a semaphore. Destroy a semaphore and release all the tasks currently pending on it. A semaphore exists in the system since rt_sem_create() has been called to create it, so this service must be called in order to destroy it afterwards.
Side-effect: This routine calls the rescheduling procedure if tasks have been woken up as a result of the deletion. Context: This routine can always be called on behalf of a task, or from the initialization code. |
|
Inquire about a semaphore. Return various information about the status of a given semaphore.
Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |
|
Pend on a semaphore. Acquire a semaphore unit. If the semaphore value is greater than zero, it is decremented by one and the service immediately returns to the caller. Otherwise, the caller is blocked until the semaphore is either signaled or destroyed, unless a non-blocking operation has been required.
Side-effect: This routine calls the rescheduling procedure unless a semaphore unit is immediately available, or timeout specifies a non-blocking operation. Context: This routine can be called on behalf of a task. It can also be called on behalf of an interrupt context or from the initialization code provided timeout is equal to RT_TIME_NONBLOCK.
|
|
Signal a semaphore. Release a semaphore unit. If the semaphore is pended, the first waiting task (by queuing order) is immediately unblocked; otherwise, the semaphore value is incremented by one.
Side-effect: This routine calls the rescheduling procedure if a task is woken up as a result of the operation. Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |