Skip to content

Commit f1d72d4

Browse files
authored
Remove backpressure.set bindings (#1449)
This is on its way out and shouldn't be used.
1 parent 10c6acd commit f1d72d4

File tree

5 files changed

+10
-32
lines changed

5 files changed

+10
-32
lines changed

crates/c/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,6 @@ typedef enum {snake}_waitable_state {{
756756
{shouty}_WAITABLE_CANCELLED,
757757
}} {snake}_waitable_state_t;
758758
759-
void {snake}_backpressure_set(bool enable);
760759
void {snake}_backpressure_inc(void);
761760
void {snake}_backpressure_dec(void);
762761
void* {snake}_context_get(void);
@@ -823,13 +822,6 @@ void {snake}_task_cancel() {{
823822
__task_cancel();
824823
}}
825824
826-
__attribute__((__import_module__("$root"), __import_name__("[backpressure-set]")))
827-
extern void __backpressure_set(bool enable);
828-
829-
void {snake}_backpressure_set(bool enable) {{
830-
__backpressure_set(enable);
831-
}}
832-
833825
__attribute__((__import_module__("$root"), __import_name__("[backpressure-inc]")))
834826
extern void __backpressure_inc(void);
835827

crates/guest-rust/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,6 @@ pub mod examples;
873873
#[doc(hidden)]
874874
pub mod rt;
875875

876-
#[cfg(feature = "async")]
877-
#[allow(deprecated)]
878-
pub use rt::async_support::backpressure_set;
879876
#[cfg(feature = "async-spawn")]
880877
pub use rt::async_support::spawn;
881878
#[cfg(feature = "inter-task-wakeup")]

crates/guest-rust/src/rt/async_support.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -622,24 +622,6 @@ pub async fn yield_async() {
622622
Yield::default().await;
623623
}
624624

625-
/// Call the `backpressure.set` canonical built-in function.
626-
///
627-
/// When `enabled` is `true`, this tells the host to defer any new calls to this
628-
/// component instance until further notice (i.e. until `backpressure.set` is
629-
/// called again with `enabled` set to `false`).
630-
#[deprecated = "use backpressure_{inc,dec} instead"]
631-
pub fn backpressure_set(enabled: bool) {
632-
extern_wasm! {
633-
#[link(wasm_import_module = "$root")]
634-
extern "C" {
635-
#[link_name = "[backpressure-set]"]
636-
fn backpressure_set(_: i32);
637-
}
638-
}
639-
640-
unsafe { backpressure_set(if enabled { 1 } else { 0 }) }
641-
}
642-
643625
/// Call the `backpressure.inc` canonical built-in function.
644626
pub fn backpressure_inc() {
645627
extern_wasm! {

tests/runtime-async/async/cancel-import/test.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@ test_callback_code_t exports_test_pending_import_callback(test_event_t *event) {
5050
}
5151

5252
void exports_test_backpressure_set(bool x) {
53-
test_backpressure_set(x);
53+
if (x) {
54+
test_backpressure_inc();
55+
} else {
56+
test_backpressure_dec();
57+
}
5458
}

tests/runtime-async/async/cancel-import/test.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ impl crate::exports::my::test::i::Guest for Component {
1212
}
1313

1414
fn backpressure_set(x: bool) {
15-
#[expect(deprecated)]
16-
return wit_bindgen::backpressure_set(x);
15+
if x {
16+
wit_bindgen::backpressure_inc();
17+
} else {
18+
wit_bindgen::backpressure_dec();
19+
}
1720
}
1821
}

0 commit comments

Comments
 (0)