[entropy.db] rewrite locking infrastructure, handle multithreading use case
[entropy.db] implement locking infrastructure (with the same semantics) for in-memory repositories