Are reading operations in the dense_hash_map thread safe?
Are reading operations in the dense_hash_map thread safe?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
constC++ object of reentrant type (most are) is generally assumed to be thread-safe.The documentation of
dense_hash_mapdoesn’t specify anything regarding thread-safety, so the most defensive approach would be to assume it isn’t even reentrant. It takes unprotected global mutable state to make a class non-reentrant, though, and it’s hard to find an argument fordense_hash_mapto require that, but seeing as it stores its contents to disk, that might be all you can hope for. To assume the thing is thread-safe even on mutable operations is far-fetched without confirmation from the documentation.Barring documentation, you might want to have a look at the implementation to see whether you can verify reentrancy for at least some subset of the API.