Im using System V Message Queue, which does not have a "timed receive" function, like POSIX MQ. But now i need it (this timed receive func.).
One can ask: "so why dont you use POSIX instead of Sys V?". Because in my benchmarks SysV MQ was +- 20% faster than POSIX MQ.
Now the question. How to fake a "timed receive" for Sys V MQ?
I wrote a piece of code that does it testing msgrcv
with IPC_NOWAIT
in a loop with usleep
.
I think its ugly, so i need ideas to write a beautiful one =]