--- ./src/thread_pool.c.orig 2015-06-23 11:22:18.408373704 -0200 +++ ./src/thread_pool.c 2015-06-23 11:31:55.926972746 -0200 @@ -42,12 +42,15 @@ #define pthread_mutex_unlock debug_pthread_mutex_unlock #endif +/* set default stack size to 1MB */ +#define PMACCT_STACKSIZE 1024*1024 thread_pool_t *allocate_thread_pool(int count) { int i, rc; thread_pool_t *pool; thread_pool_item_t *worker; + pthread_attr_t attr, *attrptr = NULL; // Allocate pool pool = malloc(sizeof(thread_pool_t)); @@ -88,7 +91,19 @@ /* Create the thread */ worker->thread = malloc(sizeof(pthread_t)); - rc = pthread_create(worker->thread, NULL, thread_runner, worker); + rc = pthread_attr_init(&attr); + if (rc) { + printf("ERROR: pthread_attr_init failed: %s\n", strerror(rc)); + } else { + rc = pthread_attr_setstacksize(&attr, PMACCT_STACKSIZE); + if (rc) { + printf("ERROR: pthread_attr_setstack failed: %s\n", strerror(rc)); + } else { + attrptr=&attr; + } + } + + rc = pthread_create(worker->thread, attrptr, thread_runner, worker); if (rc) { printf("ERROR: thread creation failed: %s\n", strerror(rc));