q_receive and timer

Hello,
I want to use a timeout for receiving a message using mq_receive, so I’m using timer_timeout before calling mq_receive. This works most of time, but sometimes the mq_receive is not unblocked… I wonder why ? I am using the flag : _NTO_TIMEOUT_REPLY when calling timer_timeout, is it enough ? Also I’m creating a new timer each time before calling mq_receive, is there a limit fot the number of timer created at the same time ?

Other question : What’s happend is the timer_timeout is used and the previous call is not finished, is the timeout duration restart ?

Thanks a lot
Alain

You want to use mq_timedreceive().

Any idea why mq_timedreceive() sets errno to EINTR instead of ETIMEDOUT when timing out?

It’s the problem that after mq_timedreceive() reply blocked on “mqueue”, a timeout will causing a UNBLOCK pulse send to the server (mqueue). The server has no idea this UNBLOCK pulse is caused by timer (vs signal), can only let the client go with EINTR.

There is a PR filed internally but I don’t think we have good solution at this moment.