47cc319f9164381a92c6bb1e0ee374d8378bcd48
[urcu.git] / tests / test_atomic.c
1 #include <stdio.h>
2 #include <arch_atomic.h>
3 #include <assert.h>
4
5 struct testvals {
6 unsigned char c;
7 unsigned short s;
8 unsigned int i;
9 unsigned long l;
10 };
11
12 static struct testvals vals;
13
14 int main(int argc, void **argv)
15 {
16 atomic_add(&vals.c, 10);
17 assert(vals.c == 10);
18 atomic_add(&vals.c, -11);
19 assert((char)vals.c == -1);
20 }
This page took 0.037909 seconds and 3 git commands to generate.