Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2008-09-02 16:17:41 +0400
committerSebastien Pouliot <sebastien@ximian.com>2008-09-02 16:17:41 +0400
commit11618319858e4c0da3245dd4df0375707371a9f2 (patch)
treeb50e1ede8bc597e4ffe5edd6aef71b5a5b09f94c
parent781670784f9d87a247b67fe962f7a3524f4f3a71 (diff)
2008-09-02 Sebastien Pouliot <sebastien@ximian.com>mono-2-0-rc3mono-2-0-rc2mono-2-0-rc1mono-2-0-1-rc1mono-2-0-1mono-2-0mono-2-0
* DoubleCheckLockingRule.cs: Current rule logic does not apply for Fx 2.0 and later runtimes, so we limit it for 1.x. A new rule (with shared logic) should be done to handle 2.0 specific stuff. svn path=/branches/mono-2-0/mono-tools/; revision=112080
-rw-r--r--gendarme/rules/Gendarme.Rules.Concurrency/ChangeLog6
-rw-r--r--gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs11
2 files changed, 14 insertions, 3 deletions
diff --git a/gendarme/rules/Gendarme.Rules.Concurrency/ChangeLog b/gendarme/rules/Gendarme.Rules.Concurrency/ChangeLog
index 126f8daf..03acd031 100644
--- a/gendarme/rules/Gendarme.Rules.Concurrency/ChangeLog
+++ b/gendarme/rules/Gendarme.Rules.Concurrency/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-02 Sebastien Pouliot <sebastien@ximian.com>
+
+ * DoubleCheckLockingRule.cs: Current rule logic does not apply for
+ Fx 2.0 and later runtimes, so we limit it for 1.x. A new rule (with
+ shared logic) should be done to handle 2.0 specific stuff.
+
2008-08-13 Sebastien Pouliot <sebastien@ximian.com>
* DoNotLockOnThisOrTypesRule.cs: Use TraceBack rocks. Don't ignore
diff --git a/gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs b/gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs
index 91e4f3e5..65b5f729 100644
--- a/gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs
+++ b/gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs
@@ -40,8 +40,6 @@ using Gendarme.Framework.Rocks;
namespace Gendarme.Rules.Concurrency {
- // FIXME?: see http://groups.google.com/group/gendarme/browse_thread/thread/b46d1ddc3a2d8fb9#msg_9b9c2989cedb4c34
-
// note: the rule only report a single double-lock per method
[Problem ("This method uses the unreliable double-check locking technique.")]
@@ -55,6 +53,13 @@ namespace Gendarme.Rules.Concurrency {
{
base.Initialize (runner);
+ // we only want to run this on assemblies that use either the
+ // 1.0 or 1.1 runtime - since the memory model, at that time,
+ // was not entirely safe for double check locks
+ Runner.AnalyzeAssembly += delegate (object o, RunnerEventArgs e) {
+ Active = (e.CurrentAssembly.Runtime < TargetRuntime.NET_2_0);
+ };
+
// is this module using Monitor.Enter ? (lock in c#)
// if not then this rule does not need to be executed for the module
// note: mscorlib.dll is an exception since it defines, not refer, System.Threading.Monitor
@@ -91,7 +96,7 @@ namespace Gendarme.Rules.Concurrency {
if (insn.Offset >= monitorOffsetList.Peek ())
continue;
- Runner.Report (method, insn, Severity.Medium, Confidence.High, String.Empty);
+ Runner.Report (method, insn, Severity.Medium, Confidence.High);
return RuleResult.Failure;
}
}