Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
2008-09-02 Sebastien Pouliot <sebastien@ximian.com>
Browse files Browse the repository at this point in the history
	* 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
Sebastien Pouliot committed Sep 2, 2008
1 parent 7816707 commit 1161831
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions 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
Expand Down
Expand Up @@ -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.")]
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 1161831

Please sign in to comment.