←Older revision | Revision as of 09:40, 7 June 2025 | ||
Line 43: | Line 43: | ||
if (data.compareAndSet(current, new Data(v1, v2, v3))) { | if (data.compareAndSet(current, new Data(v1, v2, v3))) { | ||
+ | // CAS checks the value in data is still == to current | ||
+ | // if so it changes it to new Data and we can return | ||
return; | return; | ||
} | } | ||
+ | // otherwise try again | ||
} | } | ||
} | } |