Boost logo

Boost Users :

Subject: [Boost-users] [Interprocess] message queue Cannot Allocate Memory
From: cons_Pavignani, Antonio (Antonio.Pavignani_at_[hidden])
Date: 2012-12-07 06:34:21


Dear all,

I use the message queue. I create a queue inside a thread (called Thread A) and I use it in another thread (called Thread B).
I get this error: Cannot Allocate memory.

This is the code related to the Thread A:

    message_queue::remove(InterprocessQueueName.c_str());
    message_queue mq(open_or_create,InterprocessQueueName.c_str(),MAX_INTERPROCESS_SEND_QUEUE_SIZE,CalculatingSizeStructure::maxSizeHMIExtMessage);

     for(;;)
    {
        try
        {
            unsigned int priority;
            std::size_t recvd_size;

            mq.receive(msgBuffer, CalculatingSizeStructure::maxSizeHMIExtMessage, recvd_size, priority);

...
}
catch (interprocess_exception &ex)
{
...
}
}

This is the code related to the Thread B:

            boost::interprocess::message_queue *mq = InterprocessQueueManager::getInstance()->openQueue("Library_Queue");
                if((mq->try_send(&msgCmdSendStatusToLibraryInfoR,sizeof(LibraryInfo),0))==false)
                {...
                }

I've looked for that exception, and it seems to be related to the POSIX queue. I've also tried some solutions without results.

Any ideas?

Thanks in advance,

Best Regards

Antonio



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net