Skip to content

Commit

Permalink
Mutex<Work>Work (#1156)
Browse files Browse the repository at this point in the history
I missed this one in #1132, but it's another case where the mutex is
unnecessary.

Exclusive (or shared + immutable) borrowing of the `Work` is guaranteed by the
borrow checker, because the `struct Work` is exclusively owned by the
`Downstairs`.

Therefore, I replaced `Downstairs::work_lock` with `Downstairs::work` and
`Downstairs::work_mut`, retaining the same checks for whether the upstairs is
active.  The relevant portion of new code is
[here](https://github.com/oxidecomputer/crucible/compare/main...mkeeter:more-mutex-removal?expand=1#diff-ccb2591a32a7a66c4c4cbb1125ce4e72d2d1b2f10e805991a30f9e8643e3d954R1945-R1964);
most everything else is boilerplate (since like #1132, removing the async borrow
changes other functions from `async` to sync).
  • Loading branch information
mkeeter authored Feb 13, 2024
1 parent a1f3207 commit 43dace9
Showing 1 changed file with 204 additions and 273 deletions.
Loading

0 comments on commit 43dace9

Please sign in to comment.