Functions | |
| POSEXTERN POSSEMA_t POSCALL | posSemaCreate (INT_t initcount) |
| POSEXTERN void POSCALL | posSemaDestroy (POSSEMA_t sema) |
| POSEXTERN VAR_t POSCALL | posSemaGet (POSSEMA_t sema) |
| POSEXTERN VAR_t POSCALL | posSemaSignal (POSSEMA_t sema) |
| POSEXTERN VAR_t POSCALL | posSemaWait (POSSEMA_t sema, UINT_t timeoutticks) |
Semaphores are implemented as counters. A task requesting a semaphore (via posSemaGet or posSemaWait) will decrement the counter. If the counter is zero, the task willing to decrement the counter is blocked. When a semaphore is signaled (via posSemaSignal), the counter is incremented. If the counter reaches a positive, nonzero value, the highest priorized task pending on the semaphore is set to running state and can decrement the counter by itself.
Semaphore function. Allocates a new semaphore object.
| initcount | Initial semaphore count (see detailed semaphore description). |
| POSEXTERN void POSCALL posSemaDestroy | ( | POSSEMA_t | sema | ) |
Semaphore function. Frees a no more needed semaphore object.
| sema | handle to the semaphore object. |
Semaphore function. This function tries to get the semaphore object. If the semaphore is in nonsignalized state (that means its counter is zero or less), this function blocks the task execution until the semaphore gets signaled.
| sema | handle to the semaphore object. |
Semaphore function. This function signalizes a semaphore object, that means it increments the semaphore counter and sets tasks pending on the semaphore to running state, when the counter reaches a positive, nonzero value.
| sema | handle to the semaphore object. |
Semaphore function. This function tries to get the semaphore object. If the semaphore is in nonsignalized state (that means its counter is zero or less), this function blocks the task execution until the semaphore gets signaled or a timeout happens.
| sema | handle to the semaphore object. | |
| timeoutticks | timeout in timer ticks (see HZ define and MS macro). If this parameter is set to zero, the function immediately returns. If this parameter is set to INFINITE, the function will never time out. |
1.5.4