diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj
index 2d775508f97f37..010d1d4bca6cdf 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj
@@ -257,10 +257,8 @@
- Interop\Windows\Kernel32\Interop.ExitProcess.cs
+ Common\Interop\Windows\Kernel32\Interop.ExitProcess.cs
-
-
@@ -268,33 +266,31 @@
System\Runtime\InteropServices\BuiltInVariantExtensions.cs
- Interop\Windows\Advapi32\Interop.RegisterEventSource_IntPtr.cs
+ Common\Interop\Windows\Advapi32\Interop.RegisterEventSource_IntPtr.cs
- Interop\Windows\Advapi32\Interop.DeregisterEventSource.cs
+ Common\Interop\Windows\Advapi32\Interop.DeregisterEventSource.cs
Common\Interop\Windows\Advapi32\Interop.ReportEvent_IntPtr.cs
- Interop\Windows\Kernel32\Interop.RaiseFailFastException.cs
+ Common\Interop\Windows\Kernel32\Interop.RaiseFailFastException.cs
- Interop\Windows\Ole32\Interop.CoInitializeEx.cs
+ Common\Interop\Windows\Ole32\Interop.CoInitializeEx.cs
- Interop\Windows\Ole32\Interop.CoUninitialize.cs
+ Common\Interop\Windows\Ole32\Interop.CoUninitialize.cs
- Interop\Windows\Ole32\Interop.CoGetApartmentType.cs
+ Common\Interop\Windows\Ole32\Interop.CoGetApartmentType.cs
- Interop\Windows\OleAut32\Interop.VariantClear.cs
+ Common\Interop\Windows\OleAut32\Interop.VariantClear.cs
-
-
@@ -303,13 +299,13 @@
- Interop\Unix\System.Native\Interop.Abort.cs
+ Common\Interop\Unix\System.Native\Interop.Abort.cs
- Interop\Unix\System.Native\Interop.Exit.cs
+ Common\Interop\Unix\System.Native\Interop.Exit.cs
- Interop\Unix\System.Native\Interop.MProtect.cs
+ Common\Interop\Unix\System.Native\Interop.MProtect.cs
diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ConditionVariable.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ConditionVariable.cs
deleted file mode 100644
index 966e1f01e86e1c..00000000000000
--- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.ConditionVariable.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Kernel32
- {
- [StructLayout(LayoutKind.Sequential)]
- internal struct CONDITION_VARIABLE
- {
- private IntPtr Ptr;
- }
-
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- internal static unsafe partial void InitializeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
-
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- internal static unsafe partial void WakeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
-
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static unsafe partial bool SleepConditionVariableCS(CONDITION_VARIABLE* ConditionVariable, CRITICAL_SECTION* CriticalSection, int dwMilliseconds);
- }
-}
diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CriticalSection.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CriticalSection.cs
deleted file mode 100644
index 01a70df823ded2..00000000000000
--- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CriticalSection.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Kernel32
- {
- [StructLayout(LayoutKind.Sequential)]
- internal struct CRITICAL_SECTION
- {
- private IntPtr DebugInfo;
- private int LockCount;
- private int RecursionCount;
- private IntPtr OwningThread;
- private IntPtr LockSemaphore;
- private UIntPtr SpinCount;
- }
-
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- internal static unsafe partial void InitializeCriticalSection(CRITICAL_SECTION* lpCriticalSection);
-
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- internal static unsafe partial void EnterCriticalSection(CRITICAL_SECTION* lpCriticalSection);
-
- [SuppressGCTransition]
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- internal static unsafe partial void LeaveCriticalSection(CRITICAL_SECTION* lpCriticalSection);
-
- [DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
- [LibraryImport(Libraries.Kernel32)]
- internal static unsafe partial void DeleteCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- }
-}
diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
index d297affcabc559..bd846a6aed09b1 100644
--- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
+++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
@@ -1311,7 +1311,6 @@
-
@@ -1708,7 +1707,7 @@
Common\Interop\Windows\Advapi32\Interop.EncryptDecrypt.cs
- Interop\Windows\Advapi32\Interop.EqualSid.cs
+ Common\Interop\Windows\Advapi32\Interop.EqualSid.cs
Common\Interop\Windows\Advapi32\Interop.EventActivityIdControl.cs
@@ -1735,13 +1734,13 @@
Common\Interop\Windows\Advapi32\Interop.GetLengthSid.cs
- Interop\Windows\Advapi32\Interop.GetSecurityInfoByHandle.cs
+ Common\Interop\Windows\Advapi32\Interop.GetSecurityInfoByHandle.cs
- Interop\Windows\Advapi32\Interop.GetSidIdentifierAuthority.cs
+ Common\Interop\Windows\Advapi32\Interop.GetSidIdentifierAuthority.cs
- Interop\Windows\Advapi32\Interop.GetTokenInformation.cs
+ Common\Interop\Windows\Advapi32\Interop.GetTokenInformation.cs
Common\Interop\Windows\Advapi32\Interop.GetTokenInformation_void.cs
@@ -1822,7 +1821,7 @@
Common\Interop\Windows\Kernel32\Interop.CancelIoEx.cs
- Interop\Windows\Kernel32\Interop.CancelSynchronousIo.cs
+ Common\Interop\Windows\Kernel32\Interop.CancelSynchronousIo.cs
Common\Interop\Windows\Kernel32\Interop.CloseHandle.cs
@@ -1830,9 +1829,6 @@
Common\Interop\Windows\Kernel32\Interop.CompletionPort.cs
-
- Common\Interop\Windows\Kernel32\Interop.ConditionVariable.cs
-
Common\Interop\Windows\Kernel32\Interop.Constants.cs
@@ -1867,13 +1863,13 @@
Common\Interop\Windows\Kernel32\Interop.Semaphore.cs
- Interop\Windows\Kernel32\Interop.Timer.cs
+ Common\Interop\Windows\Kernel32\Interop.Timer.cs
- Interop\Windows\Kernel32\Interop.ThreadPoolIO.cs
+ Common\Interop\Windows\Kernel32\Interop.ThreadPoolIO.cs
- Interop\Windows\Kernel32\Interop.ThreadPool.cs
+ Common\Interop\Windows\Kernel32\Interop.ThreadPool.cs
Common\Interop\Windows\NtDll\Interop.NtCreateFile.cs
@@ -1905,9 +1901,6 @@
Common\Interop\Windows\Kernel32\Interop.CreateSymbolicLink.cs
-
- Common\Interop\Windows\Kernel32\Interop.CriticalSection.cs
-
Common\Interop\Windows\Kernel32\Interop.DeviceIoControl.cs
@@ -1999,7 +1992,7 @@
Common\Interop\Windows\Kernel32\Interop.GetCurrentThreadId.cs
- Interop\Windows\Kernel32\Interop.GetTickCount64.cs
+ Common\Interop\Windows\Kernel32\Interop.GetTickCount64.cs
Common\Interop\Windows\Kernel32\Interop.GetFileAttributesEx.cs
@@ -2104,7 +2097,7 @@
Common\Interop\Windows\Kernel32\Interop.MoveFileEx.cs
- Interop\Windows\Kernel32\Interop.OpenThread.cs
+ Common\Interop\Windows\Kernel32\Interop.OpenThread.cs
Common\Interop\Windows\Kernel32\Interop.OSVERSIONINFOEX.cs
@@ -2263,7 +2256,7 @@
Common\Interop\Windows\Ole32\Interop.CoCreateGuid.cs
- Interop\Windows\Ole32\Interop.CoGetContextToken.cs
+ Common\Interop\Windows\Ole32\Interop.CoGetContextToken.cs
Common\Interop\Windows\Ole32\Interop.CoGetStandardMarshal.cs
@@ -2390,7 +2383,6 @@
-
@@ -2728,6 +2720,7 @@
+
diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelMonitor.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelMonitor.Windows.cs
deleted file mode 100644
index ab4dedc4a5a528..00000000000000
--- a/src/libraries/System.Private.CoreLib/src/System/Threading/LowLevelMonitor.Windows.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.Threading
-{
- internal unsafe partial struct LowLevelMonitor
- {
- internal struct Monitor
- {
- // We cannot allocate CRITICAL_SECTION on GC heap. The CRITICAL_SECTION documentation
- // explicitly says that critical section object cannot be moved or copied. The debug
- // info attached to critical section has back pointer to the owning CRITICAL_SECTION,
- // and moving CRITICAL_SECTION around makes this back pointer orphaned.
- public Interop.Kernel32.CRITICAL_SECTION _criticalSection;
- public Interop.Kernel32.CONDITION_VARIABLE _conditionVariable;
- }
-
- private Monitor* _pMonitor;
-
- public void Initialize()
- {
- _pMonitor = (Monitor*)Marshal.AllocHGlobal(sizeof(Monitor));
-
- Interop.Kernel32.InitializeCriticalSection(&_pMonitor->_criticalSection);
- Interop.Kernel32.InitializeConditionVariable(&_pMonitor->_conditionVariable);
- }
-
- private void DisposeCore()
- {
- if (_pMonitor == null)
- {
- return;
- }
-
- Interop.Kernel32.DeleteCriticalSection(&_pMonitor->_criticalSection);
- Marshal.FreeHGlobal((IntPtr)_pMonitor);
- _pMonitor = null;
- }
-
- private void AcquireCore()
- {
- Interop.Kernel32.EnterCriticalSection(&_pMonitor->_criticalSection);
- }
-
- private void ReleaseCore()
- {
- Interop.Kernel32.LeaveCriticalSection(&_pMonitor->_criticalSection);
- }
-
- private void WaitCore()
- {
- WaitCore(-1);
- }
-
- private bool WaitCore(int timeoutMilliseconds)
- {
- Debug.Assert(timeoutMilliseconds >= -1);
- return Interop.Kernel32.SleepConditionVariableCS(&_pMonitor->_conditionVariable, &_pMonitor->_criticalSection, timeoutMilliseconds);
- }
-
- private void Signal_ReleaseCore()
- {
- Interop.Kernel32.WakeConditionVariable(&_pMonitor->_conditionVariable);
- Interop.Kernel32.LeaveCriticalSection(&_pMonitor->_criticalSection);
- }
- }
-}