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.Diagnostics;
6 using System.IO;
7 
8 namespace System.Threading
9 {
10     public sealed partial class Semaphore
11     {
VerifyNameForCreate(string name)12         private static void VerifyNameForCreate(string name)
13         {
14             if (name != null)
15             {
16                 throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
17             }
18         }
19 
CreateSemaphoreCore(int initialCount, int maximumCount, string name, out bool createdNew)20         private void CreateSemaphoreCore(int initialCount, int maximumCount, string name, out bool createdNew)
21         {
22             Debug.Assert(name == null);
23 
24             SafeWaitHandle = WaitSubsystem.NewSemaphore(initialCount, maximumCount);
25             createdNew = true;
26         }
27 
OpenExistingWorker(string name, out Semaphore result)28         private static OpenExistingResult OpenExistingWorker(string name, out Semaphore result)
29         {
30             throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
31         }
32 
ReleaseCore(IntPtr handle, int releaseCount)33         private static int ReleaseCore(IntPtr handle, int releaseCount)
34         {
35             return WaitSubsystem.ReleaseSemaphore(handle, releaseCount);
36         }
37     }
38 }
39