Synchronization Variables
To be found in man sync(3F):
perform atomically k->j Operation and return the old or the new value:
OP stands for the functions:
- add, sub, or, and, xor, nand;
i,j,k,l can be integer*4 or integer*8 variables
all these functions are guaranteed to be atomic and will be performed on globally visible arguments
i = fetch_and_OP(j,k) <- atomically i=j, j OP k
i = OP_and_fetch(j,k) <- atomically j OP k, i=j
l = compare_and_swap(j,k,i) <- (j==k)? j=i,l=1 : l=0
i = lock_test_and_set(j,k) <- atomically: i=j, j=k
call lock_release(i) <- atomically: i=0
memory references will not cross FMB