[svn-commits] ivaxer: branch ivaxer/ast_storage r282428 - /team/ivaxer/ast_storage/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 16 06:21:33 CDT 2010


Author: ivaxer
Date: Mon Aug 16 06:21:22 2010
New Revision: 282428

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=282428
Log:
added locking in "release"-functions

Modified:
    team/ivaxer/ast_storage/main/storage.c

Modified: team/ivaxer/ast_storage/main/storage.c
URL: http://svnview.digium.com/svn/asterisk/team/ivaxer/ast_storage/main/storage.c?view=diff&rev=282428&r1=282427&r2=282428
==============================================================================
--- team/ivaxer/ast_storage/main/storage.c (original)
+++ team/ivaxer/ast_storage/main/storage.c Mon Aug 16 06:21:22 2010
@@ -247,10 +247,17 @@
 		ast_storage_fileinst_release(fo->metadata);
 	}
 
+	if (!AST_RWLIST_WRLOCK(&fo->files)) {
+		ast_log(LOG_WARNING, "Unable to lock file instances list\n");
+		return;
+	}
+
 	while ((inst = AST_RWLIST_REMOVE_HEAD(&fo->files, list))) {
 		ast_storage_fileinst_release(inst);
 	}
 
+	AST_RWLIST_UNLOCK(&fo->files);
+
 	ast_free(fo);
 }
 
@@ -301,9 +308,16 @@
 		return;
 	}
 
+	if (!AST_RWLIST_WRLOCK(fobjs)) {
+		ast_log(LOG_WARNING, "Unable to lock fileobjects list\n");
+		return;
+	}
+
 	while ((fo = AST_RWLIST_REMOVE_HEAD(fobjs, list))) {
 		ast_storage_fileobject_release(fo);
 	}
+
+	AST_RWLIST_UNLOCK(fobjs);
 
 	ast_free(fobjs);
 }




More information about the svn-commits mailing list