Skip to content

Commit d3dffb9

Browse files
jkoritzinskyjkotas
andauthored
Move the implementation of Monitor to managed in CoreCLR (#118371)
Co-authored-by: Jan Kotas <[email protected]>
1 parent d3b4005 commit d3dffb9

File tree

77 files changed

+1330
-5237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1330
-5237
lines changed

src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@
235235
<Compile Include="$(BclSourcesRoot)\System\StubHelpers.cs" />
236236
<Compile Include="$(BclSourcesRoot)\System\Text\StringBuilder.CoreCLR.cs" />
237237
<Compile Include="$(BclSourcesRoot)\System\Threading\Interlocked.CoreCLR.cs" />
238+
<Compile Include="$(BclSourcesRoot)\System\Threading\ManagedThreadId.CoreCLR.cs" />
238239
<Compile Include="$(BclSourcesRoot)\System\Threading\Monitor.CoreCLR.cs" />
240+
<Compile Include="$(BclSourcesRoot)\System\Threading\ObjectHeader.CoreCLR.cs" />
239241
<Compile Include="$(BclSourcesRoot)\System\Threading\SynchronizationContext.CoreCLR.cs" />
240242
<Compile Include="$(BclSourcesRoot)\System\Threading\Thread.CoreCLR.cs" />
241243
<Compile Include="$(BclSourcesRoot)\System\Threading\WaitHandle.CoreCLR.cs" />

src/coreclr/System.Private.CoreLib/src/System/Environment.CoreCLR.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private static unsafe string[] InitializeCommandLineArgs(char* exePath, int argc
104104
}
105105

106106
[LibraryImport(RuntimeHelpers.QCall, EntryPoint = "Environment_GetProcessorCount")]
107-
private static partial int GetProcessorCount();
107+
internal static partial int GetProcessorCount();
108108

109109
// Used by VM
110110
internal static string? GetResourceStringLocal(string key) => SR.GetResourceString(key);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Diagnostics;
5+
6+
namespace System.Threading
7+
{
8+
internal static class ManagedThreadId
9+
{
10+
// This will be initialized by the runtime.
11+
[ThreadStatic]
12+
private static int t_currentManagedThreadId;
13+
internal static int CurrentManagedThreadIdUnchecked => t_currentManagedThreadId;
14+
15+
public static int Current => t_currentManagedThreadId;
16+
}
17+
}

0 commit comments

Comments
 (0)