aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-04 19:47:22 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-04 19:47:22 +0000
commitac1ade7444c3a81d76e879f6d3571aae3c8e7bae (patch)
treeec12e69e00eece03476c2cb0feca8bc2b7be859b /main/asterisk.c
parentc75c68f35a55aa7107e5096bde5dc4d2f0cd4a07 (diff)
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
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c8
1 files changed, 4 insertions, 4 deletions
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(&lthread, NULL, listener, NULL);
+ ast_pthread_create_background(&lthread, NULL, listener, NULL);
if (!ast_strlen_zero(ast_config_AST_CTL_OWNER)) {
struct passwd *pw;