Mercurial > sdl-ios-xcode
comparison test/testatomic.c @ 3199:3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
It also update configure.in to compile the linux version of the library. The three versions are all dummies
implementations that do nothing. They are being checked in as place holders. Mostly, I just wanted to get
place holders and the configure.in checked in.
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Wed, 24 Jun 2009 20:04:08 +0000 |
parents | 51750b7a966f |
children | c297230efc75 |
comparison
equal
deleted
inserted
replaced
3198:fefe74ca604d | 3199:3e1bf2b8bd81 |
---|---|
1 #include "SDL.h" | 1 #include "SDL.h" |
2 | 2 |
3 int | 3 int |
4 main(int argc, char **argv) | 4 main(int argc, char **argv) |
5 { | 5 { |
6 int rv = 10; | 6 /* int rv = 10; */ |
7 volatile int atomic; | 7 /* volatile int atomic; */ |
8 | 8 |
9 SDL_atomic_int_set(&atomic, 10); | 9 /* SDL_atomic_int_set(&atomic, 10); */ |
10 if (SDL_atomic_int_get(&atomic) != 10) | 10 /* if (SDL_atomic_int_get(&atomic) != 10) */ |
11 printf("Error: "); | 11 /* printf("Error: "); */ |
12 printf("SDL_atomic_int_set(atomic, 10): atomic-> %d\n", | 12 /* printf("SDL_atomic_int_set(atomic, 10): atomic-> %d\n", */ |
13 SDL_atomic_int_get(&atomic)); | 13 /* SDL_atomic_int_get(&atomic)); */ |
14 | 14 |
15 SDL_atomic_int_add(&atomic, 10); | 15 /* SDL_atomic_int_add(&atomic, 10); */ |
16 if (SDL_atomic_int_get(&atomic) != 20) | 16 /* if (SDL_atomic_int_get(&atomic) != 20) */ |
17 printf("Error: "); | 17 /* printf("Error: "); */ |
18 printf("SDL_atomic_int_add(atomic, 10): atomic-> %d\n", | 18 /* printf("SDL_atomic_int_add(atomic, 10): atomic-> %d\n", */ |
19 SDL_atomic_int_get(&atomic)); | 19 /* SDL_atomic_int_get(&atomic)); */ |
20 | 20 |
21 rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); | 21 /* rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */ |
22 if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 30) | 22 /* if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 30) */ |
23 printf("Error: "); | 23 /* printf("Error: "); */ |
24 printf("SDL_atomic_int_cmp_xchg(atomic, 20, 30): rv-> %d, atomic-> %d\n", | 24 /* printf("SDL_atomic_int_cmp_xchg(atomic, 20, 30): rv-> %d, atomic-> %d\n", */ |
25 rv, SDL_atomic_int_get(&atomic)); | 25 /* rv, SDL_atomic_int_get(&atomic)); */ |
26 | 26 |
27 rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); | 27 /* rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */ |
28 if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 30) | 28 /* if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 30) */ |
29 printf("Error: "); | 29 /* printf("Error: "); */ |
30 printf("SDL_atomic_int_cmp_xchg(atomic, 20, 40): rv-> %d, atomic-> %d\n", | 30 /* printf("SDL_atomic_int_cmp_xchg(atomic, 20, 40): rv-> %d, atomic-> %d\n", */ |
31 rv, SDL_atomic_int_get(&atomic)); | 31 /* rv, SDL_atomic_int_get(&atomic)); */ |
32 | 32 |
33 rv = SDL_atomic_int_xchg_add(&atomic, 10); | 33 /* rv = SDL_atomic_int_xchg_add(&atomic, 10); */ |
34 if (rv != 30 || SDL_atomic_int_get(&atomic) != 40) | 34 /* if (rv != 30 || SDL_atomic_int_get(&atomic) != 40) */ |
35 printf("Error: "); | 35 /* printf("Error: "); */ |
36 printf("SDL_atomic_int_xchg_add(atomic, 10): rv-> %d, atomic-> %d\n", | 36 /* printf("SDL_atomic_int_xchg_add(atomic, 10): rv-> %d, atomic-> %d\n", */ |
37 rv, SDL_atomic_int_get(&atomic)); | 37 /* rv, SDL_atomic_int_get(&atomic)); */ |
38 | 38 |
39 SDL_atomic_int_inc(&atomic); | 39 /* SDL_atomic_int_inc(&atomic); */ |
40 if (SDL_atomic_int_get(&atomic) != 41) | 40 /* if (SDL_atomic_int_get(&atomic) != 41) */ |
41 printf("Error: "); | 41 /* printf("Error: "); */ |
42 printf("SDL_atomic_int_inc(atomic): atomic-> %d\n", | 42 /* printf("SDL_atomic_int_inc(atomic): atomic-> %d\n", */ |
43 SDL_atomic_int_get(&atomic)); | 43 /* SDL_atomic_int_get(&atomic)); */ |
44 | 44 |
45 rv = SDL_atomic_int_dec_test(&atomic); | 45 /* rv = SDL_atomic_int_dec_test(&atomic); */ |
46 if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 40) | 46 /* if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 40) */ |
47 printf("Error: "); | 47 /* printf("Error: "); */ |
48 printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", | 48 /* printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */ |
49 rv, SDL_atomic_int_get(&atomic)); | 49 /* rv, SDL_atomic_int_get(&atomic)); */ |
50 | 50 |
51 SDL_atomic_int_set(&atomic, 1); | 51 /* SDL_atomic_int_set(&atomic, 1); */ |
52 if (SDL_atomic_int_get(&atomic) != 1) | 52 /* if (SDL_atomic_int_get(&atomic) != 1) */ |
53 printf("Error: "); | 53 /* printf("Error: "); */ |
54 printf("SDL_atomic_int_set(atomic, 1): atomic-> %d\n", | 54 /* printf("SDL_atomic_int_set(atomic, 1): atomic-> %d\n", */ |
55 SDL_atomic_int_get(&atomic)); | 55 /* SDL_atomic_int_get(&atomic)); */ |
56 | 56 |
57 rv = SDL_atomic_int_dec_test(&atomic); | 57 /* rv = SDL_atomic_int_dec_test(&atomic); */ |
58 if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 0) | 58 /* if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 0) */ |
59 printf("Error: "); | 59 /* printf("Error: "); */ |
60 printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", | 60 /* printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */ |
61 rv, SDL_atomic_int_get(&atomic)); | 61 /* rv, SDL_atomic_int_get(&atomic)); */ |
62 | 62 |
63 return 0; | 63 return 0; |
64 } | 64 } |