SemaphoreAcl.TryOpenExisting(String, SemaphoreRights, Semaphore) 方法

定義

嘗試開啟指定的具名旗號,如果已存在,則會套用所需的存取權限,並傳回值,指出作業是否成功。

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

例外狀況

namenull

name 為空字串。

發生 Win32 錯誤。

具名的信號已存在,但使用者沒有使用它所需的安全性存取權。

適用於