Is there a way to find out if a QNX message channel has any queued messages?
The functionality I’m looking for is this: after creating a channel with ChannelCreate(), I don’t want MsgReceivePulse() to block. Instead I want MsgReceivePulse() to return a pulse if there’s one waiting in the channel, or return an error if the channel is empty. This behavoir is very much like sem_trywait().
If QNX has a function to test the emptyness of a message channel, then I can use that to write an implementation of MsgTryReceivePulse().
I implemented a POSIX semaphore replacement with message pulse, and got a substantial performance boost. My semaphore operations now take approximately 40% less time. Not surprising results considering QNX is optimized for message passing.