Hacker News new | ask | show | jobs
by twmb 2599 days ago
This is a decent reminder blog post about something that is obvious on the surface, but subtle when you forget to think about it and make a mistake.

I've found that thinking of a lock as something you don't want to hold goes a long way. The point of locks is to release them.

Jeff Preshing has a good series on locks and concurrency. This[0] post (potentially with an extra dozen I read in the same sitting) is the one that really changed how I thought about locks: before I read it, I was very into lock freedom at every opportunity.

0: https://preshing.com/20111118/locks-arent-slow-lock-contenti...