##### Synopsis

    #include <ctl_api.h>
    void *ctl_message_queue_receive(CTL_MESSAGE_QUEUE_t *m,
                                    unsigned use_timeout,
                                    CTL_TIME_t timeout);

##### Description

The function ctl_message_queue_receive returns the oldest message in the message queue pointed at by m. This function will block if no messages are available unless use_timeout is non-zero and the current time reaches the timeout value. If the timeout occured the function returns zero.

##### Restrictions

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

##### Portability

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

##### See Also

Message queues