Can I use message queues to exchange threads

I am creating several workflows from the main thread. Can I create a message_queue for each thread from the main thread and send messages from the main thread. I ask about this because message queues are designed for interprocess communication.

Do I need to consider anything specific regarding this

+4
source share
1 answer

As mentioned the Error Message Queue is not based on the POSIX message queue? (and is mentioned in the documentation). If you are talking about threads, you have the same address space and you do not need inter-process communication capabilities.

I would advise using the STL container of your choice in my wrapper class (has a relationship) and surround the setter / receiver with mutable exclusion / mutex elements, as indicated How to create synchronization mechanisms in shared memory segments? Missing object serialization is a performance advantage over interprocess communication - copying pieces of data between process boundaries. On the other hand, you can use all neat features, for example. shared_ptr .

+4
source

All Articles