mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 15:29:05 +00:00
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
This commit is contained in:
@@ -300,7 +300,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);
|
||||
@@ -312,7 +312,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;
|
||||
}
|
||||
@@ -859,7 +859,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]);
|
||||
@@ -917,7 +917,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;
|
||||
|
||||
Reference in New Issue
Block a user