[Asterisk-code-review] utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN (...asterisk[13])

Sean Bright asteriskteam at digium.com
Fri Oct 18 13:52:55 CDT 2019


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13080


Change subject: utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN
......................................................................

utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN

ASTERISK-28590 #close

Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c
---
M include/asterisk/utils.h
1 file changed, 8 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/13080/1

diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index bcd73aa..bd4664b 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -423,10 +423,16 @@
  * Thread management support (should be moved to lock.h or a different header)
  */
 
-#define AST_STACKSIZE (((sizeof(void *) * 8 * 8) - 16) * 1024)
+#if defined(PTHREAD_STACK_MIN)
+# define AST_STACK_MIN PTHREAD_STACK_MIN
+#else
+# define AST_STACK_MIN 0
+#endif
+
+#define AST_STACKSIZE MAX((((sizeof(void *) * 8 * 8) - 16) * 1024), AST_STACK_MIN)
 
 #if defined(LOW_MEMORY)
-#define AST_BACKGROUND_STACKSIZE (((sizeof(void *) * 8 * 2) - 16) * 1024)
+#define AST_BACKGROUND_STACKSIZE MAX((((sizeof(void *) * 8 * 2) - 16) * 1024), AST_STACK_MIN)
 #else
 #define AST_BACKGROUND_STACKSIZE AST_STACKSIZE
 #endif

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13080
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c
Gerrit-Change-Number: 13080
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191018/24734a57/attachment.html>


More information about the asterisk-code-review mailing list