Main index | Section 2 | Options |
#include <mqueue.h>
If the specified message queue is not full, mq_send() will behave as if the message is inserted into the message queue at the position indicated by the msg_prio argument. A message with a larger numeric value of msg_prio will be inserted before messages with lower values of msg_prio. A message will be inserted after other messages in the queue, if any, with equal msg_prio. The value of msg_prio should be less than { MQ_PRIO_MAX}.
If the specified message queue is full and O_NONBLOCK is not set in the message queue description associated with mqdes, mq_send() will block until space becomes available to enqueue the message, or until mq_send() is interrupted by a signal. If more than one thread is waiting to send when space becomes available in the message queue and the Priority Scheduling option is supported, then the thread of the highest priority that has been waiting the longest will be unblocked to send its message. Otherwise, it is unspecified which waiting thread is unblocked. If the specified message queue is full and O_NONBLOCK is set in the message queue description associated with mqdes, the message will not be queued and mq_send() will return an error.
The mq_timedsend() system call will add a message to the message queue specified by mqdes in the manner defined for the mq_send() system call. However, if the specified message queue is full and O_NONBLOCK is not set in the message queue description associated with mqdes, the wait for sufficient room in the queue will be terminated when the specified timeout expires. If O_NONBLOCK is set in the message queue description, this system call is equivalent to mq_send().
The timeout will expire when the absolute time specified by abs_timeout passes, as measured by the clock on which timeouts are based (that is, when the value of that clock equals or exceeds abs_timeout), or if the absolute time specified by abs_timeout has already been passed at the time of the call.
The timeout is based on the CLOCK_REALTIME clock.
[EAGAIN] | |
The O_NONBLOCK flag is set in the message queue description associated with mqdes, and the specified message queue is full. | |
[EBADF] | |
The mqdes argument is not a valid message queue descriptor open for writing. | |
[EINTR] | |
A signal interrupted the call to mq_send() or mq_timedsend(). | |
[EINVAL] | |
The value of msg_prio was outside the valid range. | |
[EINVAL] | |
The process or thread would have blocked, and the abs_timeout parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. | |
[EMSGSIZE] | |
The specified message length, msg_len, exceeds the message size attribute of the message queue. | |
[ETIMEDOUT] | |
The O_NONBLOCK flag was not set when the message queue was opened, but the timeout expired before the message could be added to the queue. | |
MQ_SEND (2) | November 29, 2005 |
Main index | Section 2 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | The most important thing in the programming language is the name. A language will not succeed without a good name. I have recently invented a very good name and now I am looking for a suitable language. | ” |
— Donald Knuth |