|   | InterprocessLockGetNamedSemaphore(Boolean, Int32, Int32) Method | 
        
        
            Gets a uniquely named inter-process Semaphore associated with the running application, typically used to detect whether some number of
            instances of the application are already running.
            
        
        Namespace: GSF.ThreadingAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.257-beta+00aa2366fbb9ec75f636ebc7cfa610e3826a727c
 Syntax
Syntaxpublic static Semaphore GetNamedSemaphore(
	bool perUser = true,
	int maximumCount = 10,
	int initialCount = -1
)
Public Shared Function GetNamedSemaphore ( 
	Optional perUser As Boolean = true,
	Optional maximumCount As Integer = 10,
	Optional initialCount As Integer = -1
) As Semaphore
public:
static Semaphore^ GetNamedSemaphore(
	bool perUser = true, 
	int maximumCount = 10, 
	int initialCount = -1
)
static member GetNamedSemaphore : 
        ?perUser : bool * 
        ?maximumCount : int * 
        ?initialCount : int 
(* Defaults:
        let _perUser = defaultArg perUser true
        let _maximumCount = defaultArg maximumCount 10
        let _initialCount = defaultArg initialCount -1
*)
-> Semaphore GSF.Threading.InterprocessLock.GetNamedSemaphore = function(perUser, maximumCount, initialCount);
Parameters
- perUser  Boolean  (Optional)
- Indicates whether to generate a different name for the Semaphore dependent upon the user running the application.
- maximumCount  Int32  (Optional)
- The maximum number of requests for the semaphore that can be granted concurrently.
- initialCount  Int32  (Optional)
- The initial number of requests for the semaphore that can be granted concurrently, or -1 to default to maximumCount.
Return Value
SemaphoreA uniquely named inter-process 
Semaphore specific to entry assembly; 
Semaphore is created if it does not exist.
 Exceptions
Exceptions| Exception | Condition | 
|---|
| UnauthorizedAccessException | The named semaphore exists, but the user does not have the minimum needed security access rights to use it. | 
 Remarks
Remarks
            This function uses a hash of the assembly's GUID when creating the Semaphore, if it is available. If it is not available, it uses a hash
            of the simple name of the assembly. Although the name is hashed to help guarantee uniqueness, it is still entirely possible that another application
            may use that name with the same hashing algorithm to generate its Semaphore name. Therefore, it is best to ensure that the
            GuidAttribute is defined in the AssemblyInfo of your application.
            
            The Semaphore created is "Global" meaning that it will be accessible to all active application sessions including terminal service
            sessions. This is accomplished internally by prefixing the Semaphore name with "Global\". Do not use this helper function if you need
            to create a specifically named or non-global Semaphore, such as when you need to interact with another application using a
            Semaphore that does not use this function.
            
 See Also
See Also