Do I need to protect read access to an STL container in a multithreading environment?

前端 未结 8 1779
逝去的感伤
逝去的感伤 2020-11-29 10:01

I have one std::list<> container and these threads:

  • One writer thread which adds elements indefinitely.

  • One reader/writer thread which re

8条回答
  •  感情败类
    2020-11-29 10:13

    Checkout the concurrent containers provided by Intel's Open Source Threading Building Blocks library. Look under "Container Snippets" on the Code Samples page for some examples. They have concurrent / thread-safe containers for vectors, hash maps and queues.

提交回复
热议问题