www.beck-ipc.com

@CHIP-RTOS C Library - RTOS API


RTX_Wait_Sem_Priority

Wait with a specified priority on a semaphore.

int RTX_Wait_Sem_Priority ( int semID,
                             long time_ms,                              unsigned int wait_priority);

Parameters

semID

The semaphore ID of a counting semaphore acquired by a call to RTX_Create_Sem.

time_ms

Maximum number of milliseconds to wait:

    Zero -> Wait forever for semaphore
    Positive value -> Maximum number of milliseconds to wait for resource
    Negative value -> Polling mode, return immediately.   If semaphore was not available the return value will be the -27 time-out indication.

wait_priority

The priority at which the caller wishes to wait (0 = highest).     (Note that this priority has no connection to task priorities.)   To wait in FIFO order, either have all callers use the same value here or use the alternative functions RTX_Wait_Sem() or RTX_Reserve_Sem().

Return Value

0 on success else error code.

Comments

This function may be used with either counting or resource type semaphores.

This call waits for up to a specified time on a semaphore and returns with an error if the semaphore is still not available within this time limit.   Otherwise the caller is granted the semaphore.

When more than one task is waiting for the semaphore, the task which called with the lowest wait_priority number (highest priority) will be granted the semaphore before other waiting tasks.   Tasks with matching wait_priority wait in FIFO order.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

Related Topics

RTX API   Overview

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    V1.22V1.22V1.22V1.11V1.00

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.08

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document