[asterisk-commits] dlee: branch dlee/playback-rebase r388917 - /team/dlee/playback-rebase/res/st...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 15 16:37:53 CDT 2013


Author: dlee
Date: Wed May 15 16:37:52 2013
New Revision: 388917

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388917
Log:
Used a container mutex to get rid of an object lock.

Otherwise, command queuing blocks while a command is executing.

Modified:
    team/dlee/playback-rebase/res/stasis/control.c

Modified: team/dlee/playback-rebase/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/stasis/control.c?view=diff&rev=388917&r1=388916&r2=388917
==============================================================================
--- team/dlee/playback-rebase/res/stasis/control.c (original)
+++ team/dlee/playback-rebase/res/stasis/control.c Wed May 15 16:37:52 2013
@@ -56,7 +56,8 @@
 		return NULL;
 	}
 
-	control->command_queue = ao2_container_alloc_list(0, 0, NULL, NULL);
+	control->command_queue = ao2_container_alloc_list(
+		AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);
 
 	control->channel = channel;
 
@@ -75,10 +76,8 @@
 		return NULL;
 	}
 
-	ao2_lock(control);
-	ao2_ref(command, +1);
+	/* command_queue is a thread safe list; no lock needed */
 	ao2_link(control->command_queue, command);
-	ao2_unlock(control);
 
 	ao2_ref(command, +1);
 	return command;
@@ -182,8 +181,6 @@
 	struct ao2_iterator i;
 	void *obj;
 
-	SCOPED_AO2LOCK(lock, control);
-
 	ast_assert(control->channel == chan);
 
 	i = ao2_iterator_init(control->command_queue, AO2_ITERATOR_UNLINK);




More information about the asterisk-commits mailing list