Logo

Programming-Idioms

History of Idiom 33 > diff from v24 to v25

Edit summary for version 25 by tkoenig:
New Fortran implementation by user [tkoenig]

Version 24

2019-09-27, 22:35:41

Version 25

2019-09-27, 22:38:10

Idiom #33 Atomically read and update variable

Assign variable x the new value f(x), making sure that no other thread may modify x between the read and the write.

Idiom #33 Atomically read and update variable

Assign variable x the new value f(x), making sure that no other thread may modify x between the read and the write.

Code
integer, dimension[*] :: x

critical
  x = f(x)
end critical
Comments bubble
This is for a coarray scalar variable, which could be changed by another image.