atomic operations
int atomic_xchg ( volatile __global int *p, int val)
Description
Swaps the old
value stored at location p
with new value given by val
. Returns old
value.
from: https://www.khronos.org/registry/OpenCL/sdk/1.1/docs/man/xhtml/atomic_xchg.html