Closed InsertCreativityHere closed 8 months ago
I could have been sure that I initially used a mutex on the session but was getting a weird deadlock, so I switched to using a RwLock
for server_config
and splitting them apart. Have you tested this PR yet?
This PR centralizes all our locking to a single file:
main.rs
. Every other file operates without concern or knowledge of mutexes and locks. This makes it easier to see where and reason about how we lock things.It also simplifies the lockes themselves. Currently,
Session
looks like:Instead of having separate locks on each field, this PR moves the lock up a level to
Session
itself. In practice, this makes no difference. Everywhere where we lockedserver_config
, we lockedconfiguration_sets
on the line above it. So, no difference to flow or performance.And theoritically, it would be strange for 1 thread to be mutating
server_config
, while another mutatesconfiguration_sets
. The configuration sets depend on the server's configuration after all. So I think requiring a thread to lock both is saner too.