Skip to content

Commit 85c7895

Browse files
committed
supress CA2002
1 parent 90510ea commit 85c7895

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Renci.SshNet/Common/Lock.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ namespace Renci.SshNet.Common
55
{
66
internal sealed class Lock
77
{
8-
private readonly object _lockObject = new object();
9-
108
public bool TryEnter()
119
{
12-
return Monitor.TryEnter(_lockObject);
10+
#pragma warning disable CA2002 // Do not lock on objects with weak identity
11+
return Monitor.TryEnter(this);
12+
#pragma warning restore CA2002 // Do not lock on objects with weak identity
1313
}
1414

1515
public void Exit()
1616
{
17-
Monitor.Exit(_lockObject);
17+
Monitor.Exit(this);
1818
}
1919
}
2020
}

0 commit comments

Comments
 (0)