[svn-commits] dhubbard: branch 1.4 r82286 - /branches/1.4/apps/app_meetme.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Sep 12 15:24:25 CDT 2007
Author: dhubbard
Date: Wed Sep 12 15:24:24 2007
New Revision: 82286
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82286
Log:
remove a race condition for the creation of recordthread's, and fix a small memory leak. This closes issue# 10636
Modified:
branches/1.4/apps/app_meetme.c
Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=82286&r1=82285&r2=82286
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Wed Sep 12 15:24:24 2007
@@ -331,6 +331,7 @@
unsigned int isdynamic:1; /*!< Created on the fly? */
unsigned int locked:1; /*!< Is the conference locked? */
pthread_t recordthread; /*!< thread for recording */
+ ast_mutex_t recordthreadlock; /*!< control threads trying to start recordthread */
pthread_attr_t attr; /*!< thread attribute */
const char *recordingfilename; /*!< Filename to record the Conference into */
const char *recordingformat; /*!< Format to record the Conference in */
@@ -757,6 +758,8 @@
ast_mutex_init(&cnf->playlock);
ast_mutex_init(&cnf->listenlock);
+ cnf->recordthread = AST_PTHREADT_NULL;
+ ast_mutex_init(&cnf->recordthreadlock);
ast_copy_string(cnf->confno, confno, sizeof(cnf->confno));
ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
@@ -1253,7 +1256,10 @@
ast_hangup(conf->chan);
else
close(conf->fd);
-
+
+ ast_mutex_destroy(&conf->playlock);
+ ast_mutex_destroy(&conf->listenlock);
+ ast_mutex_destroy(&conf->recordthreadlock);
free(conf);
return 0;
@@ -1429,7 +1435,8 @@
}
}
- if ((conf->recording == MEETME_RECORD_OFF) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
+ ast_mutex_lock(&conf->recordthreadlock);
+ if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
ztc.chan = 0;
@@ -1446,6 +1453,7 @@
pthread_attr_destroy(&conf->attr);
}
}
+ ast_mutex_unlock(&conf->recordthreadlock);
time(&user->jointime);
More information about the svn-commits
mailing list