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

Friendly Automation asteriskteam at digium.com
Mon Oct 21 13:21:32 CDT 2019


Friendly Automation has submitted this change and it was merged. ( 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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index bcd73aa..2e652c3 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_THREAD_STACK_MIN PTHREAD_STACK_MIN
+#else
+# define AST_THREAD_STACK_MIN 0
+#endif
+
+#define AST_STACKSIZE MAX((((sizeof(void *) * 8 * 8) - 16) * 1024), AST_THREAD_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_THREAD_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: 3
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191021/77ddbb57/attachment.html>


More information about the asterisk-code-review mailing list