A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Enable controlling `concurrency_support` in the C API (#12703)
Alex Crichton0dc25e6db03f
diff --git a/crates/c-api/include/wasmtime/config.h b/crates/c-api/include/wasmtime/config.hindex 978b613c37..01f8b7a4b7 100644--- a/crates/c-api/include/wasmtime/config.h+++ b/crates/c-api/include/wasmtime/config.h@@ -824,6 +824,15 @@ WASM_API_EXTERN void wasmtime_pooling_allocation_strategy_set(*/WASMTIME_CONFIG_PROP(void, wasm_component_model, bool)+/**+ * \brief Specifies whether support for concurrent execution of WebAssembly is+ * supported within this store.+ *+ * For more information see the Rust documentation at+ * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.concurrency_support.+ */+WASMTIME_CONFIG_PROP(void, concurrency_support, bool)+#endif // WASMTIME_FEATURE_COMPONENT_MODEL#ifdef __cplusplusdiff --git a/crates/c-api/include/wasmtime/config.hh b/crates/c-api/include/wasmtime/config.hhindex 59d549899d..ff418d1fe4 100644--- a/crates/c-api/include/wasmtime/config.hh+++ b/crates/c-api/include/wasmtime/config.hh@@ -619,6 +619,17 @@ public:wasmtime_pooling_allocation_strategy_set(ptr.get(), config.capi());}#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR++ /**+ * \brief Specifies whether support for concurrent execution of WebAssembly is+ * supported within this store.+ *+ * For more information see the Rust documentation at+ * https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.concurrency_support.+ */+ void concurrency_support(bool enable) {+ wasmtime_config_concurrency_support_set(ptr.get(), enable);+ }};} // namespace wasmtimediff --git a/crates/c-api/src/config.rs b/crates/c-api/src/config.rsindex ea8a42394e..365fd37b4c 100644--- a/crates/c-api/src/config.rs+++ b/crates/c-api/src/config.rs@@ -697,3 +697,8 @@ pub extern "C" fn wasmtime_pooling_allocation_strategy_set(c.config.allocation_strategy(InstanceAllocationStrategy::Pooling(pc.config.clone()));}++#[unsafe(no_mangle)]+pub extern "C" fn wasmtime_config_concurrency_support_set(c: &mut wasm_config_t, enable: bool) {+ c.config.concurrency_support(enable);+}diff --git a/crates/c-api/tests/config.cc b/crates/c-api/tests/config.ccindex 1d61d232a8..3637dd4b25 100644--- a/crates/c-api/tests/config.cc+++ b/crates/c-api/tests/config.cc@@ -69,6 +69,7 @@ TEST(Config, Smoke) {config.cranelift_flag_set("foo", "bar");EXPECT_TRUE(config.cache_load_default());EXPECT_FALSE(config.cache_load("nonexistent"));+ config.concurrency_support(false);PoolAllocationConfig pooling_config;config.pooling_allocation_strategy(pooling_config);