diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-05-24 18:30:19 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-05-24 18:30:19 +0000 |
commit | 4b3a3fb14c298512ef69e17a710e210de14914fb (patch) | |
tree | 86895556d8f221a39105f4398a54d612fbbd3da8 /channels/chan_h323.c | |
parent | bcd2bd8294408ca2f432747ef2e3073edecec4c1 (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 'channels/chan_h323.c')
-rw-r--r-- | channels/chan_h323.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 65154b618..e8d091528 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -2601,7 +2601,6 @@ restartsearch: static int restart_monitor(void) { - pthread_attr_t attr; /* If we're supposed to be stopped -- stay stopped */ if (ast_mutex_lock(&monlock)) { ast_log(LOG_WARNING, "Unable to lock monitor\n"); @@ -2620,17 +2619,13 @@ static int restart_monitor(void) /* Wake up the thread */ pthread_kill(monitor_thread, SIGURG); } else { - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); /* Start a new monitor */ - if (ast_pthread_create_background(&monitor_thread, &attr, do_monitor, NULL) < 0) { + if (ast_pthread_create_detached_background(&monitor_thread, NULL, do_monitor, NULL) < 0) { monitor_thread = AST_PTHREADT_NULL; ast_mutex_unlock(&monlock); ast_log(LOG_ERROR, "Unable to start monitor thread.\n"); - pthread_attr_destroy(&attr); return -1; } - pthread_attr_destroy(&attr); } ast_mutex_unlock(&monlock); return 0; |