annotate 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
rev   line source
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
1 #include "SDL.h"
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
2
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
3 int
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
4 main(int argc, char **argv)
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
5 {
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
6 /* int rv = 10; */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
7 /* volatile int atomic; */
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
8
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
9 /* SDL_atomic_int_set(&atomic, 10); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
10 /* if (SDL_atomic_int_get(&atomic) != 10) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
11 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
12 /* printf("SDL_atomic_int_set(atomic, 10): atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
13 /* SDL_atomic_int_get(&atomic)); */
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
14
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
15 /* SDL_atomic_int_add(&atomic, 10); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
16 /* if (SDL_atomic_int_get(&atomic) != 20) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
17 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
18 /* printf("SDL_atomic_int_add(atomic, 10): atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
19 /* SDL_atomic_int_get(&atomic)); */
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
20
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
21 /* rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
22 /* if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 30) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
23 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
24 /* printf("SDL_atomic_int_cmp_xchg(atomic, 20, 30): rv-> %d, atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
25 /* rv, SDL_atomic_int_get(&atomic)); */
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
26
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
27 /* rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
28 /* if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 30) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
29 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
30 /* printf("SDL_atomic_int_cmp_xchg(atomic, 20, 40): rv-> %d, atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
31 /* rv, SDL_atomic_int_get(&atomic)); */
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
32
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
33 /* rv = SDL_atomic_int_xchg_add(&atomic, 10); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
34 /* if (rv != 30 || SDL_atomic_int_get(&atomic) != 40) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
35 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
36 /* printf("SDL_atomic_int_xchg_add(atomic, 10): rv-> %d, atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
37 /* rv, SDL_atomic_int_get(&atomic)); */
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
38
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
39 /* SDL_atomic_int_inc(&atomic); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
40 /* if (SDL_atomic_int_get(&atomic) != 41) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
41 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
42 /* printf("SDL_atomic_int_inc(atomic): atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
43 /* SDL_atomic_int_get(&atomic)); */
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
44
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
45 /* rv = SDL_atomic_int_dec_test(&atomic); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
46 /* if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 40) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
47 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
48 /* printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
49 /* rv, SDL_atomic_int_get(&atomic)); */
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
50
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
51 /* SDL_atomic_int_set(&atomic, 1); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
52 /* if (SDL_atomic_int_get(&atomic) != 1) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
53 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
54 /* printf("SDL_atomic_int_set(atomic, 1): atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
55 /* SDL_atomic_int_get(&atomic)); */
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
56
3199
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
57 /* rv = SDL_atomic_int_dec_test(&atomic); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
58 /* if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 0) */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
59 /* printf("Error: "); */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
60 /* printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */
3e1bf2b8bd81 This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents: 3186
diff changeset
61 /* rv, SDL_atomic_int_get(&atomic)); */
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
62
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
63 return 0;
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
64 }