Download STLite/OS20 Real-Time Kernel Reference Manual
Transcript
6 Semaphores semaphore_init_priority Initialize a priority queued semaphore. Synopsis: #include <semaphor.h> void semaphore_init_priority(semaphore_t *sem, int value); Arguments: semaphore_t* sem int value The semaphore to be initialized. The initial value of the semaphore. Results: None. Errors: None. Description: This function initializes a counting semaphore to value. Semaphores initialized with this function have the usual semaphore semantics, except that when a task calls semaphore_wait() it will be inserted into the queue of waiting tasks so that the list remains sorted by the task’s priority, highest priority first. In this way when a task is removed from the front of the queue by semaphore_signal(), it is guaranteed to be the task with the highest priority of all those waiting for the semaphore. sem should be declared before the call to semaphore_init_priority is made. See also: semaphore_create_priority 113