Remove unnecessary recursive locking from Http2Stream.Complete (#36030)
authorStephen Toub <stoub@microsoft.com>
Fri, 8 May 2020 00:58:18 +0000 (20:58 -0400)
committerGitHub <noreply@github.com>
Fri, 8 May 2020 00:58:18 +0000 (20:58 -0400)
We just asserted we're holding the lock.  We don't need to take it again.

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs

index 2948820..6c66a67 100644 (file)
@@ -329,14 +329,11 @@ namespace System.Net.Http
 
                 _connection.RemoveStream(this);
 
-                lock (SyncObject)
+                CreditWaiter? w = _creditWaiter;
+                if (w != null)
                 {
-                    CreditWaiter? w = _creditWaiter;
-                    if (w != null)
-                    {
-                        w.Dispose();
-                        _creditWaiter = null;
-                    }
+                    w.Dispose();
+                    _creditWaiter = null;
                 }
             }