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

前端 未结 8 1774
逝去的感伤
逝去的感伤 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:08

    Yes. I would suggest wrapping your STL library with a class that enforces serial access. Or find a similar class that's already been debugged.

提交回复
热议问题