[svn-commits] mmichelson: branch group/CCSS r240313 - /team/group/CCSS/main/ccss.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 14 17:27:24 CST 2010


Author: mmichelson
Date: Thu Jan 14 17:27:22 2010
New Revision: 240313

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=240313
Log:
Push device state unsubscription to the taskprocessor thread.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=240313&r1=240312&r2=240313
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Jan 14 17:27:22 2010
@@ -2011,14 +2011,25 @@
 	return 0;
 }
 
+static int generic_agent_devstate_unsubscribe(void *data)
+{
+	struct ast_cc_agent *agent = data;
+	struct cc_generic_agent_pvt *generic_pvt = agent->private_data;
+
+	if (generic_pvt->sub != NULL) {
+		generic_pvt->sub = ast_event_unsubscribe(generic_pvt->sub);
+	}
+	cc_unref(agent, "Done unsubscribing from devstate");
+	return 0;
+}
+
 static void generic_agent_devstate_cb(const struct ast_event *event, void *userdata)
 {
 	struct ast_cc_agent *agent = userdata;
-	struct cc_generic_agent_pvt *generic_pvt = agent->private_data;
 	struct ast_str *str = ast_str_alloca(128);
 	ast_str_set(&str, 0, "%s is no longer busy\n", agent->interface);
-	ast_assert(generic_pvt->sub != NULL);
-	generic_pvt->sub = ast_event_unsubscribe(generic_pvt->sub);
+	/* We can't unsubscribe from device state events here because it causes a deadlock */
+	ast_taskprocessor_push(cc_core_taskprocessor, generic_agent_devstate_unsubscribe, cc_ref(agent, "ref agent for device state unsubscription"));
 	ast_cc_agent_caller_available(agent->core_id, ast_str_buffer(str));
 }
 




More information about the svn-commits mailing list