Safe parallel read-only access to a STL container

后端 未结 2 460
醉酒成梦
醉酒成梦 2021-01-31 19:22

I want access a STL based container read-only from parallel running threads. Without using any user implemented locking. The base of the follow

2条回答
  •  误落风尘
    2021-01-31 19:48

    Yes, you are right. You are safe as long as the thread that populates your vector finishes doing so before the reader threads start. There was a similar question recently.

提交回复
热议问题