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 // See the LICENSE file in the project root for more information. 4 5 using System; 6 using System.Runtime.InteropServices; 7 8 internal partial class Interop 9 { 10 internal partial class Kernel32 11 { 12 [StructLayout(LayoutKind.Sequential)] 13 internal struct CRITICAL_SECTION 14 { 15 private IntPtr DebugInfo; 16 private int LockCount; 17 private int RecursionCount; 18 private IntPtr OwningThread; 19 private IntPtr LockSemaphore; 20 private UIntPtr SpinCount; 21 } 22 23 [DllImport(Libraries.Kernel32)] InitializeCriticalSection(out CRITICAL_SECTION lpCriticalSection)24 internal static extern void InitializeCriticalSection(out CRITICAL_SECTION lpCriticalSection); 25 26 [DllImport(Libraries.Kernel32)] EnterCriticalSection(ref CRITICAL_SECTION lpCriticalSection)27 internal static extern void EnterCriticalSection(ref CRITICAL_SECTION lpCriticalSection); 28 29 [DllImport(Libraries.Kernel32)] LeaveCriticalSection(ref CRITICAL_SECTION lpCriticalSection)30 internal static extern void LeaveCriticalSection(ref CRITICAL_SECTION lpCriticalSection); 31 32 [DllImport(Libraries.Kernel32)] DeleteCriticalSection(ref CRITICAL_SECTION lpCriticalSection)33 internal static extern void DeleteCriticalSection(ref CRITICAL_SECTION lpCriticalSection); 34 } 35 } 36