fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 33: Atomically read and update variable
Idiom # 33: Atomically read and update variable
See
programming-idioms.org
:
Code
x := concur.atomic 0 for y := x.read, x.read while !x.compare_and_set y (f y)
What are effects?
Running Example
ex33 => # Note that this code does not solve the ABA problem: https://en.wikipedia.org/wiki/ABA_problem f(i) => i+1 x := concur.atomic 0 _ := for y := x.read, x.read while !x.compare_and_set y (f y) say x.read
What are effects?
last changed: 2024-07-01
next: Idiom # 34: Create a Set of objects