Skip to content
  • Milian Wolff's avatar
    Refactor ItemRepository code to make it work without recursive mutex · 80aab523
    Milian Wolff authored
    While the IndexedString used a repository with a non-recursive mutex,
    this was not a setup that worked in general: removing an item e.g.
    would deadlock in such a scenario. IndexedString got lucky because
    it never tries to delete anything from the repository...
    
    Refactor the code as follows:
    
    The bulk of what was ItemRepository is now ItemRepositoryPrivate
    and assumes that it gets accessed with external serialization.
    
    The new ItemRepository is just a shim around that Private but it
    provides the serialization by using the ThisLocker as before.
    
    This way, the Private class can call its own API in any way it wants
    and we don't run into a situation where we would accidentally deadlock
    by relocking a non-recursive mutex.
    
    For now, only the tests are using the non-recursive mutex now. Other
    repositories will be ported one-by-one now.
    80aab523