mq_timedreceive on multiple queues
Romain Geissler <[email protected]> Mon, 15 Apr 2013 09:48:05 +0200
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <CAF+LTefWbDyLPukDFei7o9LdOjoHrF6=ud5Oyk=P5epPgdz_rg@mail.gmail.com> |
Hi, I am currently facing an issue when reading in a set of several posix queues (let's say 2 different mqueues) from several processes. I currently use epoll_wait to wait for an incoming message on either queue on all listening processes, then mq_timedreceive to retrieve it from the queue. This is an issue when the number of reader process grows, as if I send only one message on a queue, all processes are awaken when epoll_wait returns, and all processes try to fetch the message. I would like to fix this and wake up only one process when listening to several queues, removing the useless user/kernel space switchs for the other listening processes. Is there any way to run a mq_receive/mq_timedreceive on several queues, that would wake up only one process? Something more or less like epoll, but that also fetches a message from the readable queues before returning. Thanks, Romain