Lock OrderedDict loop aswell to avoid mutation errors. #694 by denivyruck · Pull Request #695 · mongomock/mongomock

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be already covered. For instance, it's possible to do:

lock = RWLock()
with lock.reader():
    with lock.reader():
        ...

And it doesn't block the thread. Is that what you meant?

I now added the RLock to the _readers_queue. Other than that it changes the behavior (exceptions, deadlocks, broken tests and panic lol).