M
M
mxr2021-11-19 22:29:36
C++ / C#
mxr, 2021-11-19 22:29:36

Is map thread safety while writing from a thread?

c++20 standard. The essence of the question is stated in the title.
If the answer is no, then what would be the best way to fix this, a normal mutex?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cunion, 2021-11-19
@0hquazEd

As far as I know, none of the containers in the standard library are thread safe. Therefore, you should create a wrapper class over the container and synchronize reading and writing with std::shared_mutex.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question