##### Synopsis

    #include <ctl_api.h>
    unsigned ctl_semaphore_wait(CTL_SEMAPHORE_t *s,
                                CTL_TIMEOUT_t timeoutType,
                                CTL_TIME_t timeout);

##### Description

The ctl_semaphore_wait waits for the semaphore pointed at by s to be non-zero. If the semaphore is zero then the caller will block unless timeoutType is non-zero and the current time reaches the timeout value. If the timeout occured the function returns zero otherwise it returns one.

##### Restrictions

This function should not be called from an interrupt service routine.

##### Portability

ctl_semaphore_wait is provided in every implementation of the CrossWorks tasking library.

##### See Also

Semaphores