⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mq_receive.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>mq_receive</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_758">&nbsp;</a>NAME</h4><blockquote>mq_receive - receive a message from a message queue(<b>REALTIME</b>)</blockquote><h4><a name = "tag_000_007_759">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="mqueue.h.html">mqueue.h</a>&gt;ssize_t mq_receive(mqd_t <i>mqdes</i>, char *<i>msg_ptr</i>, size_t <i>msg_len</i>,    unsigned int *<i>msg_prio</i>);</code></pre></blockquote><h4><a name = "tag_000_007_760">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>mq_receive()</i>function is used toreceive the oldest of the highest priority message(s)from the message queue specified by<i>mqdes</i>.If the size of the buffer in bytes, specified by the<i>msg_len</i>argument,is less than the<i>mq_msgsize</i>attribute of the message queue, the function fails and returns an error.Otherwise, the selected message is removed from the queueand copied to the buffer pointed to by the<i>msg_ptr</i>argument.<p>If the value of <i>msg_len</i>is greater than {SSIZE_MAX}, the result is implementation-dependent.<p>If the argument<i>msg_prio</i>is not NULL, the priority of the selected message is storedin the location referenced by<i>msg_prio</i>.<p>If the specified message queue is empty and O_NONBLOCKis not set in the message queue description associated with<i>mqdes</i>,<i>mq_receive()</i>blocks until a message is enqueued on the message queueor until<i>mq_receive()</i>is interrupted by a signal.If more than one thread is waiting to receive a message when amessage arrives at an empty queue and the Priority Schedulingoption is supported,then the thread of highest priority that has been waiting the longestwill be selected to receive the message.Otherwise, it is unspecified which waiting thread receives the message.If the specified message queue is empty and O_NONBLOCKis set in the message queue description associated with<i>mqdes</i>,no message is removed from the queue, and<i>mq_receive()</i>returns an error.</blockquote><h4><a name = "tag_000_007_761">&nbsp;</a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>mq_receive()</i>returns the length of the selected message in bytesand the message is removed from the queue.Otherwise, no message is removed from the queue,the function returns a value of -1, and sets<i>errno</i>to indicate the error.</blockquote><h4><a name = "tag_000_007_762">&nbsp;</a>ERRORS</h4><blockquote>The <i>mq_receive()</i>function will fail if:<dl compact><dt>[EAGAIN]<dd>O_NONBLOCK was set in the message description associated with<i>mqdes</i>,and the specified message queue is empty.<dt>[EBADF]<dd>The<i>mqdes</i>argument is not a valid message queue descriptor open for reading.<dt>[EMSGSIZE]<dd>The specified message buffer size,<i>msg_len</i>,is less than the message size attribute of the message queue.<dt>[EINTR]<dd>The<i>mq_receive()</i>operation was interrupted by a signal.<dt>[ENOSYS]<dd>The<i>mq_receive()</i>function is not supported by this implementation.</dl><p>The<i>mq_receive()</i>function may fail if:<dl compact><dt>[EBADMSG]<dd>The implementation has detected a data corruption problem with the message.</dl></blockquote><h4><a name = "tag_000_007_763">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_764">&nbsp;</a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_765">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="mq_send.html">mq_send()</a></i>,<i><a href="mqueue.h.html">&lt;mqueue.h&gt;</a></i>,<i><a href="msgctl.html">msgctl()</a></i>,<i><a href="msgget.html">msgget()</a></i>,<i><a href="msgrcv.html">msgrcv()</a></i>,<i><a href="msgsnd.html">msgsnd()</a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995)</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -