question about using message queue read/write.

In using message queue,
When one process read (BLOCK) from the queue.and another process set the
queue attr as NON_BLOCK.

  1. whether the read queue process will
    be changed to read the queue with NON_BLOCK?
  2. And whether the message queue attr to each process which connect with
    is same or not?

zhz_zhang <zhz_zhang26@sina.com> wrote:

In using message queue,
When one process read (BLOCK) from the queue.and another process set the
queue attr as NON_BLOCK.

  1. whether the read queue process will
    be changed to read the queue with NON_BLOCK?
  2. And whether the message queue attr to each process which connect with
    is same or not?

You didn’t specify whether you were asking about QNX4 or QNX6. But, I think
in either case, if you set it with mq_setattr() it is global for the queue.

I think you can also do this on a per mqd basis, rather than globally
for the queue, but setting the O_NONBLOCK flag in the mq_open() call,
but I haven’t tested to make sure.

I also haven’t tested to see if the server will unblock a blocked
recv/send if the queue attribute is flipped from blocking to
non-blocking.

-David

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

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:al2o79$l2c$1@nntp.qnx.com

zhz_zhang <> zhz_zhang26@sina.com> > wrote:
In using message queue,
When one process read (BLOCK) from the queue.and another process set
the
queue attr as NON_BLOCK.

  1. whether the read queue process will
    be changed to read the queue with NON_BLOCK?
  2. And whether the message queue attr to each process which connect
    with
    is same or not?

You didn’t specify whether you were asking about QNX4 or QNX6. But, I
think
in either case, if you set it with mq_setattr() it is global for the
queue.

My system is Qnx6.1.0



I think you can also do this on a per mqd basis, rather than globally
for the queue, but setting the O_NONBLOCK flag in the mq_open() call,
but I haven’t tested to make sure.
I also haven’t tested to see if the server will unblock a blocked
recv/send if the queue attribute is flipped from blocking to
non-blocking.

It seems that the attr of queue is local not global.Because one process

set
the queue a new attr.When another process read attr of queue ,the attr
seems
never changed.

zhz_zhang <zhz_zhang26@sina.com> wrote:

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:al2o79$l2c$> 1@nntp.qnx.com> …
zhz_zhang <> zhz_zhang26@sina.com> > wrote:
In using message queue,
When one process read (BLOCK) from the queue.and another process set
the
queue attr as NON_BLOCK.

  1. whether the read queue process will
    be changed to read the queue with NON_BLOCK?
  2. And whether the message queue attr to each process which connect
    with
    is same or not?

You didn’t specify whether you were asking about QNX4 or QNX6. But, I
think
in either case, if you set it with mq_setattr() it is global for the
queue.

My system is Qnx6.1.0

I think you can also do this on a per mqd basis, rather than globally
for the queue, but setting the O_NONBLOCK flag in the mq_open() call,
but I haven’t tested to make sure.
I also haven’t tested to see if the server will unblock a blocked
recv/send if the queue attribute is flipped from blocking to
non-blocking.

It seems that the attr of queue is local not global.Because one process
set
the queue a new attr.When another process read attr of queue ,the attr
seems
never changed.

Under QNX4 the queue attribute change by one process was visible to
another process. As you say, under QNX6 it is not.

I’m not sure what the correct behaviour is – I took a look at the
docs, and at the Posix spec for the calls, I may have to do some more
reading, or discussion. My initial feeling was that the O_NONBLOCK
in the mq_open() would be local, but that the attribute structure would
be associated with the queue, rather than with the local fd, but I’m not
sure if the Posix docs support that interpretation.

-David

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

David Gibbs <dagibbs@qnx.com> wrote:

zhz_zhang <> zhz_zhang26@sina.com> > wrote:

I’m not sure what the correct behaviour is – I took a look at the
docs, and at the Posix spec for the calls, I may have to do some more
reading, or discussion. My initial feeling was that the O_NONBLOCK
in the mq_open() would be local, but that the attribute structure would
be associated with the queue, rather than with the local fd, but I’m not
sure if the Posix docs support that interpretation.

Ok, I’ve done a bit more research, and found what I need, in the Posix
spec for mq_getattr() it states:

Upon return, the following members the values associated with the open
message queue description as set when the message queue was opened and in
subsequent mqsetattr() calls: mq_flags

The rest are, essentially, queue level, rather than mqdes (local to
your process) level.

Our docs on this could use clarification/correction, and I’ll let docs
know about this.

-David

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