[asterisk-commits] rmudgett: branch 11 r379232 - /branches/11/main/logger.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 16 12:08:30 CST 2013


Author: rmudgett
Date: Wed Jan 16 12:08:27 2013
New Revision: 379232

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379232
Log:
Reduce call-id logging resource usage.

Since there is no need for the call-id logging ao2 object to have a lock,
don't create it with one.

Modified:
    branches/11/main/logger.c

Modified: branches/11/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/logger.c?view=diff&rev=379232&r1=379231&r2=379232
==============================================================================
--- branches/11/main/logger.c (original)
+++ branches/11/main/logger.c Wed Jan 16 12:08:27 2013
@@ -1291,16 +1291,14 @@
 struct ast_callid *ast_create_callid(void)
 {
 	struct ast_callid *call;
-	int using;
-
-	if (!(call = ao2_alloc(sizeof(struct ast_callid), NULL))) {
+
+	call = ao2_alloc_options(sizeof(struct ast_callid), NULL, AO2_ALLOC_OPT_LOCK_NOLOCK);
+	if (!call) {
 		ast_log(LOG_ERROR, "Could not allocate callid struct.\n");
 		return NULL;
 	}
 
-	using = ast_atomic_fetchadd_int(&next_unique_callid, +1);
-
-	call->call_identifier = using;
+	call->call_identifier = ast_atomic_fetchadd_int(&next_unique_callid, +1);
 	ast_debug(3, "CALL_ID [C-%08x] created by thread.\n", call->call_identifier);
 	return call;
 }




More information about the asterisk-commits mailing list