/
niceSOFT
/
valgrind
Обзор
Документация
Войти
/
niceSOFT
/
valgrind
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
none/tests/pth_stackalign.c
34 строки
604 B
Tom Hughes
The calculation used to round the size of a new thread's stack to a
16 ноя 2004, 22:40
16 ноя 2004, 22:40
6e422fd
Код
Авторство
О чём код?
#include <inttypes.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static void *thread_main(void *arg) { uintptr_t address = (uintptr_t)&arg; printf("alignment = %" PRIuPTR "\n", address & 3U); return NULL; } int main(int argc, char **argv) { pthread_t t; int e; if ((e = pthread_create(&t, NULL, thread_main, NULL)) != 0) { fprintf(stderr, "pthread_create: %s\n", strerror(e)); exit(1); } if ((e = pthread_join(t, NULL)) != 0) { fprintf(stderr, "pthread_join: %s\n", strerror(e)); exit(1); } exit(0); }