/// <summary>Opens an existing named semaphore.</summary>
/// <returns>A <see cref="T:System.Threading.Semaphore" /> object that represents a named system semaphore.</returns>
/// <param name="name">The name of a named system semaphore.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> is an empty string.-or-<paramref name="name" /> is longer than 260 characters.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null.</exception>
/// <exception cref="T:System.Threading.WaitHandleCannotBeOpenedException">The named semaphore does not exist.</exception>
/// <exception cref="T:System.IO.IOException">A Win32 error occurred.</exception>
/// <exception cref="T:System.UnauthorizedAccessException">The named semaphore exists, but the user does not have the security access required to use it.</exception>
/// <filterpriority>1</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
public static Semaphore OpenExisting(string name)
{
return(Semaphore.OpenExisting(name, System.Security.AccessControl.SemaphoreRights.Modify | System.Security.AccessControl.SemaphoreRights.Synchronize));
}