As a general rule, I think that queues should be used when required,
not just because they seem simpler to use because they are non-blocking.
This is not true however if you want the code portable to a non-QNX system.
Here is how I would design this.
Process A is a resource manager. The first thread that is started I’ll call A.2.
Any process can send a QNX message/pulse to this thread.
At startup, process A.2 creates anotherl thread A.1.
A.1 creates a special channel for the A.2 thread to send it a message.
A.2 knows about this channel because A.1 and A.2 share their data space.
When A.2 receives a QNX message from B,C,D,E,F, or, G, it replies immediately and then sends a QNX message to A.1.
Thread A.1 receives this message and immediately replies.
When A.1 wants to “send a message” back to A.2 it does it as follows.
If the message is small, it is just sent as the payload of a Pulse.
If the message is not small, A.1 sets up an in core FIFO queue, protected by a Mutex.
It then sends a Pulse to A.2 indicating that the FIFO is not empty.
When it receives the pulse, A.2 wakes up gains access to the mutex, and empties the FIFO.
No non-blocking Posix queue is needed.
Now let me anticpate an argument against this.
After process B-G sends a message to A.2, that process is blocked but I don’t want it to be.
This is mostly a missunderstanding and is not really correct. When B sends the message to A.2,
either B has higher priority or A.2 does.
If A.2 has a higher priority, then after the reply it will run.
If B has higher priority, then after the reply it will run.
If you happen to have SMP, then after the reply, both may run.
This is the same behavior as when using a Posix queue.
If you have multiple processors, and you are worried that two clients,
B and C for example might both try to send messages at the same time,
and that one might therefore be blocked waiting for A.2 to finish, you can implement A as a
multi-threaded resource manager.
The conditions under which this is not the right implementation are when B-G sporadically produce messages at a fast rate, but A.1 processes them slowly. In that case you could put a single Posix queue between
A.1 and A.2. An alternative would be to have A.1 put the messages in a FIFO, and have a third thread A.0 process the FIFO.