Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Merge changes from TFS - #1349

Merged
jkotas merged 1 commit into
dotnet:nmirrorfrom
dotnet-bot:from-tfs
Jun 1, 2016
Merged

jkotas merged 1 commit into
dotnet:nmirrorfrom
dotnet-bot:from-tfs

Conversation

@dotnet-bot

Copy link
Copy Markdown
Collaborator

No description provided.

CR: JKotas

Move LockHolder.cs to the same directory as Lock.cs and replace "lock (_lock)" with "using (LockHolder.Hold(_lock))" in Framework code.  The lock statement generates a call to Monitor.Enter(obj, ref lockTaken).  After ensuring (obj != null) && (lockTaken == false), Monitor.Enter tests whether (obj is Lock).  If it is, Monitor.Enter uses the fast path for acquiring the lock.  Using the LockHolder pattern allows to skip those extra checks.  In some places (e.g., in ClassConstructorRunner) the LockHolder pattern avoids potential reentrancy issues with Monitor..cctor.

For now I am keeping special handling of the Lock type in Monitor.GetLock. We also need to make sure ICorDebugThread4::GetBlockingObjects works properly in case of direct Lock.Acquire/Release calls.

[tfs-changeset: 1609410]
@jkotas
jkotas merged commit 3f76b76 into dotnet:nmirror Jun 1, 2016
@dotnet-bot
dotnet-bot deleted the from-tfs branch June 1, 2016 01:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants