Interprocess
|
Exception | Condition |
---|---|
ArgumentNullException | Argument name cannot be empty, null or white space. |
UnauthorizedAccessException | The named semaphore exists, but the user does not have the minimum needed security access rights to use it. |
This function uses a hash of the name when creating the Semaphore, not the actual name - this way restrictions on the name length do not need to be a user concern. All processes needing an inter-process Semaphore need to use this same function to ensure access to the same Semaphore.
The name can be a string of any length (must not be empty, null or white space) and is not case-sensitive. All hashes of the name used to create the global Semaphore are first converted to lower case.
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\"; it is not necessary for the user to be concerned with the length or contents of the name in this method as long as the same name is used for each application. 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.