examples: Remove unnecessary mutex

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1563>
This commit is contained in:
Sebastian Dröge 2024-10-19 17:31:47 +03:00 committed by GStreamer Marge Bot
parent 153d1bba16
commit e5a796ed2e

View file

@ -11,7 +11,6 @@ use std::{
mem, mem,
num::NonZeroU32, num::NonZeroU32,
ptr, ptr,
sync::Mutex,
}; };
use anyhow::{Context, Result}; use anyhow::{Context, Result};
@ -478,9 +477,7 @@ impl App {
.context("Couldn't wrap GL context")?; .context("Couldn't wrap GL context")?;
let gl_context = shared_context.clone(); let gl_context = shared_context.clone();
// FIXME: Once MSRV is 1.72 the Mutex is not necessary anymore because let event_proxy = event_loop.create_proxy();
// std::sync::mpsc::Sender is Sync by itself
let event_proxy = Mutex::new(event_loop.create_proxy());
#[allow(clippy::single_match)] #[allow(clippy::single_match)]
bus.set_sync_handler(move |_, msg| { bus.set_sync_handler(move |_, msg| {
@ -513,7 +510,7 @@ impl App {
_ => (), _ => (),
} }
if let Err(e) = event_proxy.lock().unwrap().send_event(Message::BusEvent) { if let Err(e) = event_proxy.send_event(Message::BusEvent) {
eprintln!("Failed to send BusEvent to event proxy: {e}") eprintln!("Failed to send BusEvent to event proxy: {e}")
} }