Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.


svn path=/branches/mono-2-0/mono-tools/; revision=112080
  • Loading branch information...
commit 11618319858e4c0da3245dd4df0375707371a9f2 1 parent 7816707
Sebastien Pouliot authored
View
6 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
View
11 gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs
@@ -40,8 +40,6 @@
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 @@ public override void Initialize (IRunner runner)
{
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 @@ public RuleResult CheckMethod (MethodDefinition method)
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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.