Mqueue Question

Can different applications have the same queue open in different modes?
i.e. some blocking and some non-blocking. Or is the blocking/non-blocking
attribute set on the queue thereby effecting all users?

Lawrence R. Sweet <lsweet@fct.ca> wrote:

Can different applications have the same queue open in different modes?
i.e. some blocking and some non-blocking. Or is the blocking/non-blocking
attribute set on the queue thereby effecting all users?

Hm… I don’t know. Clearly, there are two different places you can
set this – in the mq_attr on queue creation, and in the oflags on
each mqopen(). Intuitively, it would seem to me that setting
O_NONBLOCK in the mq_attr would make the queue non-blocking for
everyone, but if this was not set at that level, it could be
set for each open.

Also, it seems intuitive to me that, if one application opened the
queue without O_NONBLOCK, then someone else opening the queue with
O_NONBLOCK should not change it’s behaviour. And, also, that the
person opening with O_NONBLOCK should not block, but the person
opening with a different mode might fail on open.

Haven’t tried any of it, though, nor gone back to the POSIX specs
to see what they say about it.

-David

QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.