From 9f2a6c79c43317c05d7da5590d44483912c31150 Mon Sep 17 00:00:00 2001
From: Mark Spencer <markster@digium.com>
Date: Thu, 3 Mar 2005 03:46:41 +0000
Subject: [PATCH] Support > 300 threads on x86-32 and other 32-bit systems

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 include/asterisk/utils.h | 2 ++
 utils.c                  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 6e3a7d5db9..25f7e06f41 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -160,6 +160,8 @@ struct ast_realloca {
 #endif
 #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
 
+#define AST_STACK_SIZE 128 * 1024
+
 #ifdef __linux__
 #define ast_pthread_create pthread_create
 #define ast_strcasestr strcasestr
diff --git a/utils.c b/utils.c
index 0d7a8781c3..aa23541085 100755
--- a/utils.c
+++ b/utils.c
@@ -398,7 +398,7 @@ int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_ro
 		pthread_attr_init(&lattr);
 		attr = &lattr;
 	}
-	errno = pthread_attr_setstacksize(attr, PTHREAD_ATTR_STACKSIZE);
+	errno = pthread_attr_setstacksize(attr, AST_STACKSIZE);
 	if (errno)
 		ast_log(LOG_WARNING, "pthread_attr_setstacksize returned non-zero: %s\n", strerror(errno));
 	return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */
-- 
GitLab