PosixSignalRegistration.Create Method

Definition

Registers a handler that is invoked when the signal occurs.

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

Parameters

signal
PosixSignal

The signal to register for.

handler
Action<PosixSignalContext>

The handler that gets invoked.

Returns

PosixSignalRegistration

A PosixSignalRegistration instance that can be disposed to unregister the handler.

Attributes

Exceptions

handler is null.

signal is not supported by the platform.

An error occurred while setting up the signal handling or while installing the handler for the specified signal.

Remarks

Raw values can be provided for signal on Unix by casting them to PosixSignal. Default handling of the signal can be canceled through Cancel. SIGINT and SIGQUIT can be canceled on both Windows and on Unix platforms; SIGTERM can only be canceled on Unix. On Unix, terminal configuration can be canceled for SIGCHLD and SIGCONT.

Applies to