void rt_sem_init (SEM* sem, int value);
sem must point to a statically allocated structure. value is the initial value of the semaphore (usually 1).
Positive value of the semaphore variable shows how many tasks can do a 'P' operation without blocking. (Say how many tasks can enter the critical region.) Negative value of a semaphore shows that how many task is blocked on it. (Unless it is initialized to negative in advance but this would be totally senseless).
The name of P operation comes the Dutch "prolagen", a combination of "proberen" (to try) and "verlagen" (to reduce); Also from the word "passeren" (to pass).(Source: Daniel Tabak - Multiprocessors, Prentice Hall, 1990.)The name of V operation coimes from the Dutch "verhogen" (to increase) or "vrygeven" (to release).
int rt_sem_delete (SEM* sem);
sem points to the structure used in the corresponding call to rt_sem_create.
Any tasks blocked on this semaphore is allowed to run when semaphore is destroyed.
0xffff
int rt_sem_signal (SEM* sem);
sem points to the structure used in the call to rt_sem_create.
0xffff
int rt_sem_wait (SEM* sem);
sem points to the structure used in the call to rt_sem_create.
0xffff
0xffff
can be returned under normal
circumstances too and it is undistinguishable from the error code.
int rt_sem_wait_if (SEM* sem);
0xffff
0xffff
can be returned under normal
circumstances too and it is undistinguishable from the error code.
Moreover the caller cannot figure out, whether if taking the semaphore
was successful or not.
int rt_sem_wait_until (SEM* sem, RTIME time);
int rt_sem_wait_timed (SEM* sem, RTIME delay);
0xffff
0xffff
can be returned under normal
circumstances too and it is undistinguishable from the error code.
Moreover the caller cannot figure out, whether if taking the semaphore
was successful or not.