#pragma CCOD:script no #pragma CCOD:options -pthread #define _GNU_SOURCE #include #include #include #include #define NUM_THREADS 3 void *hello (void *threadid) { sleep(1); return NULL; } int main(void) { pthread_t thr[NUM_THREADS]; pthread_attr_t attr, attr2; void *stackbottom; void *stacktop; size_t stacksize; int t; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN); pthread_attr_getstack(&attr, &stackbottom, &stacksize); pthread_attr_getstackaddr(&attr, &stacktop); printf("Initialization: %p -> %p = %d kB\n", stackbottom, stacktop, stacksize >> 10); for (t=0; t %p = %d kB\n", t, stackbottom, stacktop, stacksize >> 10); pthread_attr_destroy(&attr2); } pthread_attr_destroy(&attr); return 0; }