Skip to content

Commit

Permalink
Added WithMacosMachPorts config option (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
martindevans authored Jan 26, 2024
1 parent f48c2cc commit 32aac52
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,20 @@ public Config WithCacheConfig(string? path)
return this;
}

/// <summary>
/// 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.
/// </summary>
/// <param name="enable">True to enable Mach ports or false to disable.</param>
/// <returns>Returns the current config.</returns>
public Config WithMacosMachPorts(bool enable)
{
Native.wasmtime_config_macos_use_mach_ports(handle, enable);
return this;
}

/// <inheritdoc/>
public void Dispose()
{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 32aac52

Please sign in to comment.