SemaphoreAcl.TryOpenExisting(String, SemaphoreRights, Semaphore) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
嘗試開啟指定的命名信號量(若已存在),套用所需的存取權限,並回傳一個表示操作是否成功的值。
public:
static bool TryOpenExisting(System::String ^ name, System::Security::AccessControl::SemaphoreRights rights, [Runtime::InteropServices::Out] System::Threading::Semaphore ^ % result);
public static bool TryOpenExisting(string name, System.Security.AccessControl.SemaphoreRights rights, out System.Threading.Semaphore? result);
public static bool TryOpenExisting(string name, System.Security.AccessControl.SemaphoreRights rights, out System.Threading.Semaphore result);
static member TryOpenExisting : string * System.Security.AccessControl.SemaphoreRights * Semaphore -> bool
Public Shared Function TryOpenExisting (name As String, rights As SemaphoreRights, ByRef result As Semaphore) As Boolean
參數
- name
- String
要開啟的信號旗名稱。 如果前面加上「Global」,則指的是全機的信號。 如果前面有「Local」或沒有前綴,則指的是整個會話的信號量。 前綴和名稱皆以大小寫區分。
- rights
- SemaphoreRights
期望的存取權適用於返還的信號板。
- result
- Semaphore
當此方法回傳 true時,包含一個物件,代表呼叫成功或未成功 null 時所命名的信號量。 此參數被視為未初始化。
傳回
true若命名的旗號成功開啟;否則,。 false
例外狀況
name 是 null
name 是空字串。
發生 Win32 錯誤。
命名的信號量存在,但使用者沒有使用所需的安全權限。