[svn-commits] dhubbard: branch dhubbard/named_processors r107011 - in /team/dhubbard/named_...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Mar 8 22:32:16 CST 2008


Author: dhubbard
Date: Sat Mar  8 22:32:16 2008
New Revision: 107011

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107011
Log:
module unload crashing fixed, thanks russell

Modified:
    team/dhubbard/named_processors/res/res_testobserver.c
    team/dhubbard/named_processors/res/sandbox/simobject.c
    team/dhubbard/named_processors/res/sandbox/taskprocessor.c

Modified: team/dhubbard/named_processors/res/res_testobserver.c
URL: http://svn.digium.com/view/asterisk/team/dhubbard/named_processors/res/res_testobserver.c?view=diff&rev=107011&r1=107010&r2=107011
==============================================================================
--- team/dhubbard/named_processors/res/res_testobserver.c (original)
+++ team/dhubbard/named_processors/res/res_testobserver.c Sat Mar  8 22:32:16 2008
@@ -64,7 +64,7 @@
 static const char config[] = "testobserver.conf";
   
 #define MAX_TEST_PROCESSORS 4
-#define MAX_TEST_PRODUCERS  0
+#define MAX_TEST_PRODUCERS  20
 struct simobject* simprod[MAX_TEST_PRODUCERS];
 
 AST_MUTEX_DEFINE_STATIC(_global_killflag_lock);
@@ -223,11 +223,14 @@
 	
 	ast_log(LOG_NOTICE, "-- testobserver -- unloading.\n");
 	unregister_sandbox_taskprocessor_clis();
-	for (count=MAX_TEST_PRODUCERS; count > 0; count--) {
-		((struct simobject*)simprod[count-1])->stop(s);
-	}
-	for (count=MAX_TEST_PROCESSORS; count > 0; count--) {
-		snprintf(tbuf, sizeof(tbuf), "sillyprocessor-%d", count-1);
+	for (count=0; count < MAX_TEST_PRODUCERS; count++) {
+		s = (struct simobject *)simprod[count];
+		if ( s ) { 
+			s->stop(s);
+		}
+	}
+	for (count=0; count < MAX_TEST_PROCESSORS; count++) {
+		snprintf(tbuf, sizeof(tbuf), "sillyprocessor-%d", count);
 		ast_log(LOG_NOTICE, "-- testobserver -- unloading %s\n", tbuf);
 		if (exists_taskprocessor_singleton(tbuf)) {
 			if (stop_taskprocessor_singleton(tbuf) < 0) {

Modified: team/dhubbard/named_processors/res/sandbox/simobject.c
URL: http://svn.digium.com/view/asterisk/team/dhubbard/named_processors/res/sandbox/simobject.c?view=diff&rev=107011&r1=107010&r2=107011
==============================================================================
--- team/dhubbard/named_processors/res/sandbox/simobject.c (original)
+++ team/dhubbard/named_processors/res/sandbox/simobject.c Sat Mar  8 22:32:16 2008
@@ -267,6 +267,9 @@
 			release_task(t);
 			break;
 		}
+		ast_mutex_lock(&i->_taskprocessor_lock);
+		killflag = !i->_poll_thread_run;
+		ast_mutex_unlock(&i->_taskprocessor_lock);
 	}
 	ast_log(LOG_NOTICE, "purging \'%s\'.\n", i->_name);
 	i->_is_purged = TRUE;

Modified: team/dhubbard/named_processors/res/sandbox/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/team/dhubbard/named_processors/res/sandbox/taskprocessor.c?view=diff&rev=107011&r1=107010&r2=107011
==============================================================================
--- team/dhubbard/named_processors/res/sandbox/taskprocessor.c (original)
+++ team/dhubbard/named_processors/res/sandbox/taskprocessor.c Sat Mar  8 22:32:16 2008
@@ -213,7 +213,6 @@
 	index = size_of_taskprocessor_singleton_list();
 	ast_log(LOG_DEBUG, "found taskprocessor %s at index %d\n", name, index);
 	pthread_attr_init(&_attribute[index]);
-	//pthread_attr_setdetachstate(&_attribute[index], PTHREAD_CREATE_DETACHED);
 	/* stay stopped if we are supposed to be stopped */
 	if (p->_poll_thread == AST_PTHREADT_STOP) {
 		ast_log(LOG_DEBUG, "poll thread == AST_PTHREADT_STOP.\n");
@@ -236,7 +235,7 @@
 			return -1;
 		}
 	}
-	//pthread_attr_destroy(&_attribute[index]);
+	pthread_attr_destroy(&_attribute[index]);
 	ast_mutex_unlock(&p->_taskprocessor_lock);
 	ast_log(LOG_DEBUG, "taskprocessor \'%s\' at 0x%ld constructed with poll frequency: %d\n", name, (unsigned long)p, p->_poll_freq);
 	return 0;




More information about the svn-commits mailing list