-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swap back to using mutexes to protect the type map (#152)
You would think that you should use an atomic shared pointer rather than a mutex protected shared pointer. That would make sense, then you would potentially have a lock free implementation! However the implementation as seen in libc++ and libstdc++ is to use a mutex protected shared pointer anyway. But worse than that, it just uses a hashmap of mutexes to protect the shared pointers. Specifically it looks like they just have 0xF mutexes and they hash the pointer addresses to pick one. Having only a few mutexes for the entire map is a terrible idea and causes a lot of contention. This is strictly worse than the already separated mutex per type that is achieved by this implementation.
- Loading branch information
1 parent
d0d7123
commit e71efa5
Showing
1 changed file
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters