1

I am implementing inter process communication using Boost Interprocess. As a test I took the example from the boost documentation.

The first process (which creates the message queue) starts the other (which should receive the messages from the queue) using CreateProcess(NULL, (LPSTR)commandStream.str().c_str(), NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi)

The first process creates the queue using message_queue mq(create_only, "message_queue", 100, sizeof(int)).

Unfortunately, message_queue mq(open_only, "message_queue") throws an interprocess_exception. The exception contains the description Das System kann die angegebene Datei nicht finden. (The system can't find the requested file).

When the queue's creation and opening is both done in one single process, no exception is thrown and the communication works as described in the documentation.

Does someone know what could cause the exception and how I can solve it?

Edit: I am using Boost 1.45

5
  • Could this be a permission's issue? Commented Sep 14, 2012 at 12:21
  • Yes it could. However from the CreateProcess() docs I understand that the newly created process gets the same permissions as the 'parent process'? Commented Sep 14, 2012 at 12:27
  • that is true. Now does the parent proc have permissions to create a msg queue? have you tried just creating in the parent proc and seeing if it works there? Commented Sep 14, 2012 at 12:30
  • That is interesting. Creation and opening the msg queue does not work in the parent proc, however it does in the child proc. Does that make sense? Commented Sep 14, 2012 at 13:00
  • The problem seems to be described in a ticket. Unfortunately, there currently seems to be no solution. Commented Sep 17, 2012 at 10:46

1 Answer 1

2

The exception is caused by a problem in the Boost Interpocessing library as described in this ticket. The bug has been reopened and it is not totally clear to me how the Boost code has been changed and how a workaround could be applied for Boost 1.45. However, after upgrading to Boost 1.51 I am now able to use the Message Queue as expected.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.