1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>

int
main(void) {

    int a = 1;
    int rc;

    rc = __sync_val_compare_and_swap(&a, 1, 3);
    printf("Got %d\n", rc);

    return 0;
}