thughes | 5e5e213 | 2004-11-16 19:40:05 +0000 | [diff] [blame] | 1 | #include <inttypes.h> |
| 2 | #include <pthread.h> |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | #include <string.h> |
| 6 | |
| 7 | static void *thread_main(void *arg) |
| 8 | { |
| 9 | uintptr_t address = (uintptr_t)&arg; |
| 10 | |
| 11 | printf("alignment = %" PRIuPTR "\n", address & 3U); |
| 12 | |
| 13 | return NULL; |
| 14 | } |
| 15 | |
| 16 | int main(int argc, char **argv) |
| 17 | { |
| 18 | pthread_t t; |
| 19 | int e; |
| 20 | |
| 21 | if ((e = pthread_create(&t, NULL, thread_main, NULL)) != 0) |
| 22 | { |
| 23 | fprintf(stderr, "pthread_create: %s\n", strerror(e)); |
| 24 | exit(1); |
| 25 | } |
| 26 | |
| 27 | if ((e = pthread_join(t, NULL)) != 0) |
| 28 | { |
| 29 | fprintf(stderr, "pthread_join: %s\n", strerror(e)); |
| 30 | exit(1); |
| 31 | } |
| 32 | |
| 33 | exit(0); |
| 34 | } |