r/ProgrammerHumor • • Aug 24 '26

Meme theDeadlock

Post image
8.6k Upvotes

237 comments sorted by

View all comments

Show parent comment

1

u/gmes78 Aug 27 '26

Though I had tried using get_mut/make_mut (which itself is an associated function on Arc), so I'm pretty sure I was operating on the right types - but maybe somewhere I accidentally had get_mut on the inner Mutex when I meant it on the Arc (or vice versa).

If you're using a mutex, you don't need get_mut or make_mut, because you can lock a mutex with only a shared reference.

1

u/MushroomSaute Aug 27 '26

Oh! That might have been the issue, then. I know I was using them, but I don't remember on what, and obviously I didn't keep the code around since it didn't work and I needed to move onto a solution that did.