#include <ctl_api.h> unsigned ctl_wait_semaphore(CTL_SEMAPHORE_t *s, unsigned use_timeout, CTL_TIME_t timeout);
The ctl_wait_semaphore waits for the semaphore pointed at by s to be non-zero. If the semaphore is zero then the caller will block unless use_timeout is non-zero and the current time reaches the timeout value. If the timeout occured the function returns zero otherwise it returns one.
ctl_wait_semaphore is provided in every implementation of the CrossWorks tasking library.