From ac1ade7444c3a81d76e879f6d3571aae3c8e7bae Mon Sep 17 00:00:00 2001 From: kpfleming Date: Wed, 4 Oct 2006 19:47:22 +0000 Subject: 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: http://svn.digium.com/svn/asterisk/branches/1.4@44378 f38db490-d61c-443f-a65b-d21fe96a405b --- main/asterisk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'main/asterisk.c') diff --git a/main/asterisk.c b/main/asterisk.c index 6e3222af5..75426fe4e 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -301,7 +301,7 @@ void ast_register_thread(char *name) if (!new) return; new->id = pthread_self(); - new->name = name; /* this was a copy already */ + new->name = name; /* steal the allocated memory for the thread name */ AST_LIST_LOCK(&thread_list); AST_LIST_INSERT_HEAD(&thread_list, new, list); AST_LIST_UNLOCK(&thread_list); @@ -313,7 +313,7 @@ void ast_unregister_thread(void *id) AST_LIST_LOCK(&thread_list); AST_LIST_TRAVERSE_SAFE_BEGIN(&thread_list, x, list) { - if ((void *)x->id == id) { + if ((void *) x->id == id) { AST_LIST_REMOVE_CURRENT(&thread_list, list); break; } @@ -906,7 +906,7 @@ static void *listener(void *unused) fcntl(consoles[x].p[1], F_SETFL, flags | O_NONBLOCK); consoles[x].fd = s; consoles[x].mute = ast_opt_mute; - if (ast_pthread_create(&consoles[x].t, &attr, netconsole, &consoles[x])) { + if (ast_pthread_create_background(&consoles[x].t, &attr, netconsole, &consoles[x])) { ast_log(LOG_ERROR, "Unable to spawn thread to handle connection: %s\n", strerror(errno)); close(consoles[x].p[0]); close(consoles[x].p[1]); @@ -964,7 +964,7 @@ static int ast_makesocket(void) return -1; } ast_register_verbose(network_verboser); - ast_pthread_create(<hread, NULL, listener, NULL); + ast_pthread_create_background(<hread, NULL, listener, NULL); if (!ast_strlen_zero(ast_config_AST_CTL_OWNER)) { struct passwd *pw; -- cgit v1.2.3