Comment

Comment by PaulDavisThe1st

> The only time locks beat atomics is when you are updating a bunch of things in which case it may be faster to lock once than to update 10 atomic variables.

Locks are mandatory when you're updating data that does not fit into a single atomic type. You cannot use N atomics to create atomic update of a data structure that must be semantically atomic across its N members.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton