The rtems.semaphore_obtain
directive is used to acquire the
specified semaphore. A simplified version of the
rtems.semaphore_obtain
directive can be described as follows:
if semaphore's count is greater than zero then decrement semaphore's count else wait for release of semaphore return SUCCESSFUL
When the semaphore cannot be immediately acquired, one of the following situations applies:
RTEMS.NO_WAIT
forces an immediate return
with an error status code.
If the task waits to acquire the semaphore, then it is placed in the semaphore's task wait queue in either FIFO or task priority order. If the task blocked waiting for a binary semaphore using priority inheritance and the task's priority is greater than that of the task currently holding the semaphore, then the holding task will inherit the priority of the blocking task. All tasks waiting on a semaphore are returned an error code when the semaphore is deleted.
When a task successfully obtains a semaphore using priority ceiling and the priority ceiling for this semaphore is greater than that of the holder, then the holder's priority will be elevated.
Copyright © 1988-2003 OAR Corporation