diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 4dc406db7ff0df7d3fc5c7a162f9d82d4a05005b..2b332a51f04b7b0ca1d1fcd2528ed70011a5b443 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -423,8 +423,13 @@ int ast_careful_fwrite(FILE *f, int fd, const char *s, size_t len, int timeoutms * Thread management support (should be moved to lock.h or a different header) */ -#define AST_STACKSIZE (((sizeof(void *) * 8 * 8) - 16) * 1024) -#define AST_STACKSIZE_LOW (((sizeof(void *) * 8 * 2) - 16) * 1024) +#if defined(PTHREAD_STACK_MIN) +# define AST_STACKSIZE MAX((((sizeof(void *) * 8 * 8) - 16) * 1024), PTHREAD_STACK_MIN) +# define AST_STACKSIZE_LOW MAX((((sizeof(void *) * 8 * 2) - 16) * 1024), PTHREAD_STACK_MIN) +#else +# define AST_STACKSIZE (((sizeof(void *) * 8 * 8) - 16) * 1024) +# define AST_STACKSIZE_LOW (((sizeof(void *) * 8 * 2) - 16) * 1024) +#endif int ast_background_stacksize(void);