SYNOPSIS
#include <mqueue.h>
#include <time.h>
ssize_t mq_timedreceive(mqd_t mqdes, char *restrict msg_ptr, size_t msg_len, unsigned *restrict msg_prio, const struct timespec *restrict abs_timeout);
DESCRIPTION
The
If the msg_prio argument is not NULL, the priority of the selected message is stored in the location pointed to by the msg_prio argument.
If the specified message queue is empty and does not have
O_NONBLOCK set in its message queue description,
The
abs_timeout is an absolute time. It expires when
the absolute time passes, as measured by the clock on which timeouts are
based, of it the absolute time has already passed when the function was
called.
The timeout is based on the system clock as returned
by
The resolution of the timeout is the resolution of the clock on which it is based. The <time.h> header defines the timespec type.
This operation never fails with a timeout if a message can immediately be removed from the message queue. In such a case, the validity of the abs_timeout argument is not checked.
PARAMETERS
- abs_timeout
-
Specifies the maximum wait for receiving a message on the specified message queue.
- mqdes
-
Specifies the message queue descriptor associated with the message queue on which messages are to be received.
- msg_len
-
Specifies the size, in bytes, of the buffer where the received message is stored.
- msg_prio
-
Stores the priority of the received message.
- msg_ptr
-
Points to the buffer where the received message is stored.
RETURN VALUES
On success, the
- EAGAIN
-
The O_NONBLOCK flag was set in the message description associated with mqdes, and the specified message queue is empty.
- EBADF
-
mqdes is not a valid message queue descriptor open for reading.
- EBADMSG
-
There was a data corruption problem with the message.
- EMSGSIZE
-
msg_len is less than the message size attribute of the specified message queue.
- EINTR
-
A signal interrupted an
mq_receive() operation. - EINVAL
-
The process or thread would have blocked, and the abs_timeout parameter specified an invalid value.
- ENOSPC
-
Too much space was requested for the buffer pointed to by msg_ptr.
- ETIMEDOUT
-
The O_NONBLOCK flag was not set when the message queue was opened, but no message arrived on the queue before the specified timeout expired.
CONFORMANCE
UNIX 03.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
On the NuTCRACKER Platform, the Windows
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
PTC MKS Toolkit 10.4 Documentation Build 39.