diff --git a/crates/c-api/include/wasmtime/config.h b/crates/c-api/include/wasmtime/config.h index 77c1193632..951004e96a 100644 --- a/crates/c-api/include/wasmtime/config.h +++ b/crates/c-api/include/wasmtime/config.h @@ -200,6 +200,14 @@ WASMTIME_CONFIG_PROP(void, wasm_memory64, bool) */ WASMTIME_CONFIG_PROP(void, strategy, wasmtime_strategy_t) +/** + * \brief Configure wether wasmtime should compile a module using multiple threads. + * + * For more information see the Rust documentation at + * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.parallel_compilation. + */ +WASMTIME_CONFIG_PROP(void, parallel_compilation, bool) + /** * \brief Configures whether Cranelift's debug verifier is enabled. * diff --git a/crates/c-api/src/config.rs b/crates/c-api/src/config.rs index ec7b86a8a6..275730f239 100644 --- a/crates/c-api/src/config.rs +++ b/crates/c-api/src/config.rs @@ -112,6 +112,12 @@ pub extern "C" fn wasmtime_config_strategy_set( }); } +#[no_mangle] +#[cfg(feature = "parallel-compilation")] +pub extern "C" fn wasmtime_config_parallel_compilation_set(c: &mut wasm_config_t, enable: bool) { + c.config.parallel_compilation(enable); +} + #[no_mangle] pub extern "C" fn wasmtime_config_cranelift_debug_verifier_set( c: &mut wasm_config_t, diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 60f297cba4..cc345bc7f1 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -1275,9 +1275,11 @@ impl Config { Ok(self) } - /// Configure wether wasmtime should compile a module using multiple threads. + /// Configure wether wasmtime should compile a module using multiple + /// threads. /// - /// Disabling this will result in a single thread being used to compile the wasm bytecode. + /// Disabling this will result in a single thread being used to compile + /// the wasm bytecode. /// /// By default parallel compilation is enabled. #[cfg(feature = "parallel-compilation")]