From 01afc34e830f2adf94c191a3c4f2761888dae53b Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Mon, 30 May 2011 09:58:14 +0400 Subject: set PTHREAD_STACK_MIN stack size for threads --- accel-pppd/triton/triton.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'accel-pppd/triton') diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c index d2ed595..df3d5c1 100644 --- a/accel-pppd/triton/triton.c +++ b/accel-pppd/triton/triton.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "triton_p.h" @@ -231,17 +232,21 @@ static void ctx_thread(struct _triton_context_t *ctx) struct _triton_thread_t *create_thread() { + pthread_attr_t attr; struct _triton_thread_t *thread = _malloc(sizeof(*thread)); if (!thread) { triton_log_error("out of memory"); return NULL; } + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN); + memset(thread, 0, sizeof(*thread)); pthread_mutex_init(&thread->sleep_lock, NULL); pthread_cond_init(&thread->sleep_cond, NULL); pthread_mutex_lock(&thread->sleep_lock); - if (pthread_create(&thread->thread, NULL, (void*(*)(void*))triton_thread, thread)) { + if (pthread_create(&thread->thread, &attr, (void*(*)(void*))triton_thread, thread)) { triton_log_error("pthread_create: %s", strerror(errno)); return NULL; } -- cgit v1.2.3