From 32aac52edf4598ef312230fbf1f35f86e601bae9 Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Fri, 26 Jan 2024 22:40:34 +0000 Subject: [PATCH] Added `WithMacosMachPorts` config option (#295) --- src/Config.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Config.cs b/src/Config.cs index 42788bd..357ad85 100644 --- a/src/Config.cs +++ b/src/Config.cs @@ -343,6 +343,20 @@ public Config WithCacheConfig(string? path) return this; } + /// + /// Configures whether, when on macOS, Mach ports are used for exception handling + /// instead of traditional Unix-based signal handling. + /// + /// This option defaults to true, using Mach ports by default. + /// + /// True to enable Mach ports or false to disable. + /// Returns the current config. + public Config WithMacosMachPorts(bool enable) + { + Native.wasmtime_config_macos_use_mach_ports(handle, enable); + return this; + } + /// public void Dispose() { @@ -450,6 +464,9 @@ private static class Native [DllImport(Engine.LibraryName)] public static extern IntPtr wasmtime_config_cache_config_load(Handle config, [MarshalAs(Extensions.LPUTF8Str)] string? path); + + [DllImport(Engine.LibraryName)] + public static extern void wasmtime_config_macos_use_mach_ports(Handle config, [MarshalAs(UnmanagedType.I1)] bool enable); } private readonly Handle handle;