4 ms·
This is how clojure does it: https://clojure.org/reference/atoms https://clojure.org/reference/atoms It's very costly though.
by romero-jk 5y ago
This is how clojure does it: https://clojure.org/reference/atoms https://clojure.org/reference/atoms
It's very costly though.
- dwohnitmok 5y agoIs it particularly costly compared to locks? Under the hood it's a effectively a single CAS instruction that loops on failure (which only occurs under contention, but then you have waiting with locks too).