mq_receive 调用空 POSIX 消息队列解除阻塞的顺序
Order in which mq_receive calls on an empty POSIX message queue unblock
在 没有 O_NONBLOCK 的情况下创建消息队列时,如果队列 为空 ,则 mq_receive()
调用块.当一条新消息被发送到队列时,等待中的哪个 mq_receive()
调用实际上解除了阻塞?
QNX 文档明确提到了 FIFO 顺序:
If multiple mq_receive()
calls are blocked on a single queue, then
they're unblocked in FIFO order as messages arrive.
https://www.qnx.com/developers/docs/6.3.0SP3/neutrino/lib_ref/m/mq_receive.html
所有 POSIX IPC 实施都是这种情况吗? Linux 实现是做什么的?手册页相当不具体:
If the queue is empty, then, by default, mq_receive()
blocks until a
message becomes available, or the call is interrupted by a signal
handler.
在 POSIX documentation for mq_receive()
中找到这个:
If more than one thread is waiting to receive a message when a message arrives at an empty queue and the Priority Scheduling option is supported, then the thread of highest priority that has been waiting the longest shall be selected to receive the message. Otherwise, it is unspecified which waiting thread receives the message.
Linux 联机帮助页没有提及任何关于该优先级调度规则的信息,但我不知道这是遗漏还是因为它没有实现该功能。
在 没有 O_NONBLOCK 的情况下创建消息队列时,如果队列 为空 ,则 mq_receive()
调用块.当一条新消息被发送到队列时,等待中的哪个 mq_receive()
调用实际上解除了阻塞?
QNX 文档明确提到了 FIFO 顺序:
If multiple
mq_receive()
calls are blocked on a single queue, then they're unblocked in FIFO order as messages arrive. https://www.qnx.com/developers/docs/6.3.0SP3/neutrino/lib_ref/m/mq_receive.html
所有 POSIX IPC 实施都是这种情况吗? Linux 实现是做什么的?手册页相当不具体:
If the queue is empty, then, by default,
mq_receive()
blocks until a message becomes available, or the call is interrupted by a signal handler.
在 POSIX documentation for mq_receive()
中找到这个:
If more than one thread is waiting to receive a message when a message arrives at an empty queue and the Priority Scheduling option is supported, then the thread of highest priority that has been waiting the longest shall be selected to receive the message. Otherwise, it is unspecified which waiting thread receives the message.
Linux 联机帮助页没有提及任何关于该优先级调度规则的信息,但我不知道这是遗漏还是因为它没有实现该功能。