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/branches/1.4@44378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2006-10-04 19:47:22 +00:00
parent caa0d129f2
commit ff05bf15c8
27 changed files with 83 additions and 63 deletions

View File

@@ -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