PosixSignalRegistration.Create 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
登錄 a handler ,當發生時 signal 會被調用。
public:
static System::Runtime::InteropServices::PosixSignalRegistration ^ Create(System::Runtime::InteropServices::PosixSignal signal, Action<System::Runtime::InteropServices::PosixSignalContext ^> ^ handler);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Runtime.InteropServices.PosixSignalRegistration Create(System.Runtime.InteropServices.PosixSignal signal, Action<System.Runtime.InteropServices.PosixSignalContext> handler);
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Create : System.Runtime.InteropServices.PosixSignal * Action<System.Runtime.InteropServices.PosixSignalContext> -> System.Runtime.InteropServices.PosixSignalRegistration
Public Shared Function Create (signal As PosixSignal, handler As Action(Of PosixSignalContext)) As PosixSignalRegistration
參數
- signal
- PosixSignal
要註冊的訊號。
- handler
- Action<PosixSignalContext>
被召喚的操控者。
傳回
一個 PosixSignalRegistration 可以被處理以取消註冊處理器的實例。
- 屬性
例外狀況
handler 是 null。
signal 平台不支援。
在設定訊號處理或安裝指定訊號處理程序時發生錯誤。
備註
在 Unix 上,可透過將原始值鑄造為 PosixSignal來提供signal。
訊號的預設處理可以透過 來取消 Cancel。
SIGINT 和 SIGQUIT 可以在 Windows 和 Unix 平台上取消;SIGTERM 只能在 Unix 上取消。
在 Unix 上,終端機配置可對 和 取消SIGCHLDSIGCONT。
在 .NET 10 及更新版本中,處理器的執行順序與其註冊順序相反。