diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-10-04 19:51:38 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2006-10-04 19:51:38 +0000 |
commit | 3c876af5cf3a9bd6030842b2bb2eee6917f91cd3 (patch) | |
tree | f616b825b50817c40a44bf99904c22ce68403ff8 /include/asterisk/utils.h | |
parent | de7a85105add6a14d55a91463235120883d946bc (diff) |
Merged revisions 44378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r44378 | kpfleming | 2006-10-04 14:47:22 -0500 (Wed, 04 Oct 2006) | 4 lines
update thread creation code a bit
reduce standard thread stack size slightly to allow the pthreads library to allocate the stack+data and not overflow a power-of-2 allocation in the kernel and waste memory/address space
add a new stack size for 'background' threads (those that don't handle PBX calls) when LOW_MEMORY is defined
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r-- | include/asterisk/utils.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index 2fe5a87d3..9ae2e4595 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -246,15 +246,30 @@ static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct s || (sin1->sin_port != sin2->sin_port)); } -#define AST_STACKSIZE 256 * 1024 +#define AST_STACKSIZE 240 * 1024 + +#if defined(LOW_MEMORY) +#define AST_BACKGROUND_STACKSIZE 48 * 1024 +#else +#define AST_BACKGROUND_STACKSIZE 240 * 1024 +#endif void ast_register_thread(char *name); void ast_unregister_thread(void *id); -#define ast_pthread_create(a,b,c,d) ast_pthread_create_stack(a,b,c,d,0, \ - __FILE__, __FUNCTION__, __LINE__, #c) -int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data, size_t stacksize, - const char *file, const char *caller, int line, const char *start_fn); +int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), + void *data, size_t stacksize, const char *file, const char *caller, + int line, const char *start_fn); + +#define ast_pthread_create(a, b, c, d) ast_pthread_create_stack(a, b, c, d, \ + 0, \ + __FILE__, __FUNCTION__, \ + __LINE__, #c) + +#define ast_pthread_create_background(a, b, c, d) ast_pthread_create_stack(a, b, c, d, \ + AST_BACKGROUND_STACKSIZE, \ + __FILE__, __FUNCTION__, \ + __LINE__, #c) /*! \brief Process a string to find and replace characters |