Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add locking around std::map and std::unordered_map #24

Open
gregmedd opened this issue Apr 3, 2024 · 0 comments
Open

Add locking around std::map and std::unordered_map #24

gregmedd opened this issue Apr 3, 2024 · 0 comments

Comments

@gregmedd
Copy link
Contributor

gregmedd commented Apr 3, 2024

We've encountered several places where concurrent access to maps is possible, but no locking is provided. Neither std::map or std::unordered_map are thread safe, so locks will need to be added.

One option for handling this is by adding a "safe" map wrapper that leverages a std::shared_mutex to allow parallel read-only access to the map (safe) while restricting modification to exclusive access modes. I've put a proposed PR into up-cpp with SafeMap and SafeUnorderedMap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant