Training
×

Low Level Semaphores

knCreateRtSemaphore creates a low-level semaphore with 0 or 1 initial units. Flags can be one of KN_FIFO_QUEUEING, KN_PRIORITY_QUEUEING or KN_REGION (implies priority adjustment) “or’ d” with one of KN_ZERO_UNITS or KN_ONE_UNIT.
knDeleteRtSemaphore deletes a low-level semaphore. All threads waiting at the semaphore are awakened with the E_NONEXIST exception code.
knWaitForRtSemaphore waits for a unit from the specified low-level semaphore.
knReleaseRtSemaphore releases a single unit to a specified semaphore. If threads are waiting at the semaphore, the thread at the head of the queue is awakened and given the unit.
Note: This call may trigger scheduling another thread; call knStopRtScheduler in interrupt handlers before using this call.
Warning: There is no protection against deleting a thread holding a low-level region.
Warning: If this function is invoked on a semaphore that contains the maximum of 65,535 units, the number of units in the semaphore is not incremented, and the results will be unpredictable.