validate: Mark Scenario as Send+Sync

Scenario are MT safe these days

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1265>
This commit is contained in:
Thibault Saunier 2023-05-11 10:34:35 -04:00 committed by GStreamer Marge Bot
parent 3c8eeb6482
commit bd79fcf058
4 changed files with 25 additions and 9 deletions

View file

@ -55,4 +55,3 @@ manual = [
[[object]] [[object]]
name = "GstValidate.Scenario" name = "GstValidate.Scenario"
status = "generate" status = "generate"
concurrency = "none"

View file

@ -366,6 +366,7 @@ impl<'a> ActionTypeBuilder<'a> {
} }
pub trait ActionTypeExtManual: 'static { pub trait ActionTypeExtManual: 'static {
#[doc(alias = "gst_validate_get_action_type")]
fn find(name: &str) -> Option<crate::ActionType>; fn find(name: &str) -> Option<crate::ActionType>;
} }

View file

@ -48,6 +48,9 @@ impl Scenario {
} }
} }
unsafe impl Send for Scenario {}
unsafe impl Sync for Scenario {}
mod sealed { mod sealed {
pub trait Sealed {} pub trait Sealed {}
impl<T: super::IsA<super::Scenario>> Sealed for T {} impl<T: super::IsA<super::Scenario>> Sealed for T {}
@ -105,10 +108,13 @@ pub trait ScenarioExt: IsA<Scenario> + sealed::Sealed + 'static {
} }
#[doc(alias = "action-done")] #[doc(alias = "action-done")]
fn connect_action_done<F: Fn(&Self, &Action) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_action_done<F: Fn(&Self, &Action) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn action_done_trampoline< unsafe extern "C" fn action_done_trampoline<
P: IsA<Scenario>, P: IsA<Scenario>,
F: Fn(&P, &Action) + 'static, F: Fn(&P, &Action) + Send + Sync + 'static,
>( >(
this: *mut ffi::GstValidateScenario, this: *mut ffi::GstValidateScenario,
action: *mut ffi::GstValidateAction, action: *mut ffi::GstValidateAction,
@ -134,8 +140,11 @@ pub trait ScenarioExt: IsA<Scenario> + sealed::Sealed + 'static {
} }
#[doc(alias = "done")] #[doc(alias = "done")]
fn connect_done<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_done<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn done_trampoline<P: IsA<Scenario>, F: Fn(&P) + 'static>( unsafe extern "C" fn done_trampoline<
P: IsA<Scenario>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstValidateScenario, this: *mut ffi::GstValidateScenario,
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
@ -156,10 +165,13 @@ pub trait ScenarioExt: IsA<Scenario> + sealed::Sealed + 'static {
} }
#[doc(alias = "execute-on-idle")] #[doc(alias = "execute-on-idle")]
fn connect_execute_on_idle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_execute_on_idle_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_execute_on_idle_trampoline< unsafe extern "C" fn notify_execute_on_idle_trampoline<
P: IsA<Scenario>, P: IsA<Scenario>,
F: Fn(&P) + 'static, F: Fn(&P) + Send + Sync + 'static,
>( >(
this: *mut ffi::GstValidateScenario, this: *mut ffi::GstValidateScenario,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,
@ -182,10 +194,13 @@ pub trait ScenarioExt: IsA<Scenario> + sealed::Sealed + 'static {
} }
#[doc(alias = "handles-states")] #[doc(alias = "handles-states")]
fn connect_handles_states_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_handles_states_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_handles_states_trampoline< unsafe extern "C" fn notify_handles_states_trampoline<
P: IsA<Scenario>, P: IsA<Scenario>,
F: Fn(&P) + 'static, F: Fn(&P) + Send + Sync + 'static,
>( >(
this: *mut ffi::GstValidateScenario, this: *mut ffi::GstValidateScenario,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,

View file

@ -30,6 +30,7 @@ workspace = true
all-features = true all-features = true
rustc-args = ["--cfg", "docsrs"] rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"]
features = []
[package.metadata.system-deps.gstreamer_validate_1_0] [package.metadata.system-deps.gstreamer_validate_1_0]
name = "gstreamer-validate-1.0" name = "gstreamer-validate-1.0"