From bd79fcf05881f05e5bee07bc4ec066daf79c8200 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 11 May 2023 10:34:35 -0400 Subject: [PATCH] validate: Mark Scenario as Send+Sync Scenario are MT safe these days Part-of: --- gstreamer-validate/Gir.toml | 1 - gstreamer-validate/src/action_type.rs | 1 + gstreamer-validate/src/auto/scenario.rs | 31 ++++++++++++++++++------- gstreamer-validate/sys/Cargo.toml | 1 + 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gstreamer-validate/Gir.toml b/gstreamer-validate/Gir.toml index fa744503f..5077ad226 100644 --- a/gstreamer-validate/Gir.toml +++ b/gstreamer-validate/Gir.toml @@ -55,4 +55,3 @@ manual = [ [[object]] name = "GstValidate.Scenario" status = "generate" -concurrency = "none" diff --git a/gstreamer-validate/src/action_type.rs b/gstreamer-validate/src/action_type.rs index 28cb92554..5e5fcf9ee 100644 --- a/gstreamer-validate/src/action_type.rs +++ b/gstreamer-validate/src/action_type.rs @@ -366,6 +366,7 @@ impl<'a> ActionTypeBuilder<'a> { } pub trait ActionTypeExtManual: 'static { + #[doc(alias = "gst_validate_get_action_type")] fn find(name: &str) -> Option; } diff --git a/gstreamer-validate/src/auto/scenario.rs b/gstreamer-validate/src/auto/scenario.rs index 26e81d322..b5b7cc7b5 100644 --- a/gstreamer-validate/src/auto/scenario.rs +++ b/gstreamer-validate/src/auto/scenario.rs @@ -48,6 +48,9 @@ impl Scenario { } } +unsafe impl Send for Scenario {} +unsafe impl Sync for Scenario {} + mod sealed { pub trait Sealed {} impl> Sealed for T {} @@ -105,10 +108,13 @@ pub trait ScenarioExt: IsA + sealed::Sealed + 'static { } #[doc(alias = "action-done")] - fn connect_action_done(&self, f: F) -> SignalHandlerId { + fn connect_action_done( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn action_done_trampoline< P: IsA, - F: Fn(&P, &Action) + 'static, + F: Fn(&P, &Action) + Send + Sync + 'static, >( this: *mut ffi::GstValidateScenario, action: *mut ffi::GstValidateAction, @@ -134,8 +140,11 @@ pub trait ScenarioExt: IsA + sealed::Sealed + 'static { } #[doc(alias = "done")] - fn connect_done(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn done_trampoline, F: Fn(&P) + 'static>( + fn connect_done(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn done_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( this: *mut ffi::GstValidateScenario, f: glib::ffi::gpointer, ) { @@ -156,10 +165,13 @@ pub trait ScenarioExt: IsA + sealed::Sealed + 'static { } #[doc(alias = "execute-on-idle")] - fn connect_execute_on_idle_notify(&self, f: F) -> SignalHandlerId { + fn connect_execute_on_idle_notify( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn notify_execute_on_idle_trampoline< P: IsA, - F: Fn(&P) + 'static, + F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstValidateScenario, _param_spec: glib::ffi::gpointer, @@ -182,10 +194,13 @@ pub trait ScenarioExt: IsA + sealed::Sealed + 'static { } #[doc(alias = "handles-states")] - fn connect_handles_states_notify(&self, f: F) -> SignalHandlerId { + fn connect_handles_states_notify( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn notify_handles_states_trampoline< P: IsA, - F: Fn(&P) + 'static, + F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstValidateScenario, _param_spec: glib::ffi::gpointer, diff --git a/gstreamer-validate/sys/Cargo.toml b/gstreamer-validate/sys/Cargo.toml index d3fe6a0de..b4a21fb44 100644 --- a/gstreamer-validate/sys/Cargo.toml +++ b/gstreamer-validate/sys/Cargo.toml @@ -30,6 +30,7 @@ workspace = true all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +features = [] [package.metadata.system-deps.gstreamer_validate_1_0] name = "gstreamer-validate-1.0"