A lock is a mechanism by which you forbid only one chef can access the oven at a time something like that and then semaphores allow you to do what multiple ovens that's not a bad idea. In practice in terms of bugs per line up per a thousand lines of code this is an area where everything is worse. all kinds of ordering of operations that could result in the assignment of those variables so you have to anticipate all possible orderings.

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode