0

My purpose is to create queue sets for send data to each thread, assign queue's address to each thread, and then freely pass data to by queue

To do this, what kind of method or container I use? One of the plans I came up with was to deliver data through a vector that stored the address of the concurrent_queue or a linked list of connections.

ex)
std::vector<concurrency::concurrent_queue<int>*>
or
struct ptr_queue
{
    ptr_queue* pre_node;
    concurrency::concurrent_queue<int>* m_queue;
    ptr_queue* next_node;
};

But I had doubts about whether this was the best way and, about Is there really good way.

lampseeker
  • 37
  • 6
  • What sense in pass some object to each thread ? Exist sense pass this to arbitrary worked thread. Or make some data common for all threads, but this is not pass – RbMm Sep 01 '21 at 10:07
  • 1
    From `concurrency::concurrent_queue` it looks like you're using the [Microsoft concurrency runtime](https://learn.microsoft.com/en-us/cpp/parallel/concrt/concurrency-runtime?view=msvc-160). If yes, it would help those that try to answer if you tagged the question as such and mention it in the description, because as phrased the question is very broad. – Nikos Athanasiou Sep 01 '21 at 10:39

0 Answers0