www.beck-ipc.com

@CHIP-RTOS C Library V2.00 - RTOS API


RTX_Reserve_Sem

Reserve a resource semaphore.   If current task is already the owner of this semaphore then the semaphore's usage count is incremented by one and the function returns immediately with success.

int RTX_Reserve_Sem ( int semID, long far *time_ms );

Parameters

semID

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

time_ms

Pointer for ms to wait: Zero -> Wait forever for semaphore
Positive value -> Maximum number of milliseconds to wait for resource
Negative value -> Illegal, error

Return Value

0 on success else error code.

Comments

The calling task will be suspended waiting for the resource if the resource is owned by some other task.

When the resource is finally available for use by the caller, the procedure will return with 0.

Upon first acquiring ownership of the resource, the resouce's usage count is set to one.

It is permissible for a task to call RTX_Reserve_Sem even if the calling task already owns the resource.   The resource usage count is incremented by one for each subsequent call by the resource owner.

See Also

RTOS API

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


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


End of document