summaryrefslogtreecommitdiff
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-05-24 18:30:19 +0000
committerRussell Bryant <russell@russellbryant.com>2007-05-24 18:30:19 +0000
commit4b3a3fb14c298512ef69e17a710e210de14914fb (patch)
tree86895556d8f221a39105f4398a54d612fbbd3da8 /main/asterisk.c
parentbcd2bd8294408ca2f432747ef2e3073edecec4c1 (diff)
Add a new API call for creating detached threads. Then, go replace all of the
places in the code where the same block of code for creating detached threads was replicated. (patch from bbryant) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index e95736061..a2f9efb33 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -932,9 +932,6 @@ static void *listener(void *unused)
int x;
int flags;
struct pollfd fds[1];
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
for (;;) {
if (ast_socket < 0)
return NULL;
@@ -966,7 +963,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_background(&consoles[x].t, &attr, netconsole, &consoles[x])) {
+ if (ast_pthread_create_detached_background(&consoles[x].t, NULL, 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]);
@@ -3029,13 +3026,9 @@ int main(int argc, char *argv[])
/* Console stuff now... */
/* Register our quit function */
char title[256];
- pthread_attr_t attr;
pthread_t dont_care;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_pthread_create(&dont_care, &attr, monitor_sig_flags, NULL);
- pthread_attr_destroy(&attr);
+ ast_pthread_create_detached(&dont_care, NULL, monitor_sig_flags, NULL);
set_icon("Asterisk");
snprintf(title, sizeof(title), "Asterisk Console on '%s' (pid %ld)", hostname, (long)ast_mainpid);