Skip to content

Consider leaning into the reactor pattern more, instead of using mutexes

Using Mutexes too much can be a bit of an antipattern: it introduces the possibility of deadlocks, it can interact poorly with await boundaries (see #181 (closed) too), and it can make the code a bit harder to reason about, especially when multiple locks are involved.

Some code that uses mutexes (like ClientCirc in tor-proto) uses it to share state with a separate "reactor" task. It might make more sense to make more use of that reactor (by extending the existing message-passing code), instead of having to use a mutex to share state in this way.

(There's probably more than just that example, as well!)