Skip to content

Commit 0dc25e6

Browse files
authored
Enable controlling concurrency_support in the C API (#12703)
* Enable controlling `concurrency_support` in the C API Related to #12691 * clang-format
1 parent da09374 commit 0dc25e6

4 files changed

Lines changed: 26 additions & 0 deletions

File tree

crates/c-api/include/wasmtime/config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,15 @@ WASM_API_EXTERN void wasmtime_pooling_allocation_strategy_set(
824824
*/
825825
WASMTIME_CONFIG_PROP(void, wasm_component_model, bool)
826826

827+
/**
828+
* \brief Specifies whether support for concurrent execution of WebAssembly is
829+
* supported within this store.
830+
*
831+
* For more information see the Rust documentation at
832+
* https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.concurrency_support.
833+
*/
834+
WASMTIME_CONFIG_PROP(void, concurrency_support, bool)
835+
827836
#endif // WASMTIME_FEATURE_COMPONENT_MODEL
828837

829838
#ifdef __cplusplus

crates/c-api/include/wasmtime/config.hh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,17 @@ public:
619619
wasmtime_pooling_allocation_strategy_set(ptr.get(), config.capi());
620620
}
621621
#endif // WASMTIME_FEATURE_POOLING_ALLOCATOR
622+
623+
/**
624+
* \brief Specifies whether support for concurrent execution of WebAssembly is
625+
* supported within this store.
626+
*
627+
* For more information see the Rust documentation at
628+
* https://docs.wasmtime.dev/api/wasmtime/struct.Config.html#method.concurrency_support.
629+
*/
630+
void concurrency_support(bool enable) {
631+
wasmtime_config_concurrency_support_set(ptr.get(), enable);
632+
}
622633
};
623634

624635
} // namespace wasmtime

crates/c-api/src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,3 +697,8 @@ pub extern "C" fn wasmtime_pooling_allocation_strategy_set(
697697
c.config
698698
.allocation_strategy(InstanceAllocationStrategy::Pooling(pc.config.clone()));
699699
}
700+
701+
#[unsafe(no_mangle)]
702+
pub extern "C" fn wasmtime_config_concurrency_support_set(c: &mut wasm_config_t, enable: bool) {
703+
c.config.concurrency_support(enable);
704+
}

crates/c-api/tests/config.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ TEST(Config, Smoke) {
6969
config.cranelift_flag_set("foo", "bar");
7070
EXPECT_TRUE(config.cache_load_default());
7171
EXPECT_FALSE(config.cache_load("nonexistent"));
72+
config.concurrency_support(false);
7273

7374
PoolAllocationConfig pooling_config;
7475
config.pooling_allocation_strategy(pooling_config);

0 commit comments

Comments
 (0)