[asterisk-commits] mmichelson: branch mmichelson/threadpool r376383 - in /team/mmichelson/thread...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 15 23:00:45 CST 2012


Author: mmichelson
Date: Thu Nov 15 23:00:42 2012
New Revision: 376383

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376383
Log:
Test that shutdown callback is called when expected.


Modified:
    team/mmichelson/threadpool/main/taskprocessor.c
    team/mmichelson/threadpool/tests/test_taskprocessor.c

Modified: team/mmichelson/threadpool/main/taskprocessor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/main/taskprocessor.c?view=diff&rev=376383&r1=376382&r2=376383
==============================================================================
--- team/mmichelson/threadpool/main/taskprocessor.c (original)
+++ team/mmichelson/threadpool/main/taskprocessor.c Thu Nov 15 23:00:42 2012
@@ -565,6 +565,7 @@
 void *ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
 {
 	struct ast_taskprocessor_listener *listener;
+
 	if (!tps) {
 		return NULL;
 	}

Modified: team/mmichelson/threadpool/tests/test_taskprocessor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/threadpool/tests/test_taskprocessor.c?view=diff&rev=376383&r1=376382&r2=376383
==============================================================================
--- team/mmichelson/threadpool/tests/test_taskprocessor.c (original)
+++ team/mmichelson/threadpool/tests/test_taskprocessor.c Thu Nov 15 23:00:42 2012
@@ -239,8 +239,16 @@
 		goto test_exit;
 	}
 
+	tps = ast_taskprocessor_unreference(tps);
+
+	if (!pvt->shutdown) {
+		res = AST_TEST_FAIL;
+		goto test_exit;
+	}
+
 test_exit:
 	ao2_ref(listener, -1);
+	/* This is safe even if tps is NULL */
 	ast_taskprocessor_unreference(tps);
 	return res;
 }




More information about the asterisk-commits mailing list