I have to write program that heavily uses queues from mqueue.h. The problem is it can easily reach /proc/sys/fs/mqueue/queues_max limit which I cannot change. Is it possible to wait until creation of new queue is available without hard spinning? I mean something like
do {
desc = mq_open(name, O_CREAT | O_RDONLY, 0666, NULL);
if(errno == 24) // "Too many open files"
mq_wait_for_free(); // I ask for this
else {
perror("creation of mqueue");
exit(-1);
}
} while (desc < 0);