Threadsafe Vector class for C++

前端 未结 6 665
一整个雨季
一整个雨季 2020-12-03 03:58

Does anyone know a quick and dirty threadsafe vector class for c++? I am multithreading some code, and I believe the problem I have is related to the way the vectors are us

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 04:08

    I think you'll find it far easier to continue to use std::vector, but to protect concurrent access using some kind of mutex or other operating system synchronization object. You'll also definitely want to use RAII if you are using a mutex.

提交回复
热议问题