[asterisk-commits] tilghman: branch 1.4 r154263 - /branches/1.4/channels/chan_h323.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 4 12:58:06 CST 2008
Author: tilghman
Date: Tue Nov 4 12:58:05 2008
New Revision: 154263
URL: http://svn.digium.com/view/asterisk?view=rev&rev=154263
Log:
Make the monitor thread non-detached, so it can be joined (suggested by Russell
on -dev list).
Modified:
branches/1.4/channels/chan_h323.c
Modified: branches/1.4/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_h323.c?view=diff&rev=154263&r1=154262&r2=154263
==============================================================================
--- branches/1.4/channels/chan_h323.c (original)
+++ branches/1.4/channels/chan_h323.c Tue Nov 4 12:58:05 2008
@@ -2510,7 +2510,6 @@
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");
@@ -2529,17 +2528,13 @@
/* 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_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;
@@ -3230,8 +3225,7 @@
pthread_cancel(monitor_thread);
}
pthread_kill(monitor_thread, SIGURG);
- /* Cannot join detached threads */
- /* pthread_join(monitor_thread, NULL); */
+ pthread_join(monitor_thread, NULL);
}
monitor_thread = AST_PTHREADT_STOP;
ast_mutex_unlock(&monlock);
More information about the asterisk-commits
mailing list