fn connect_to_sound_player(
    service_context_handle: ServiceContextHandle,
    sound_player_connection: Arc<Mutex<Option<PlayerProxy>>>,
) {
    fasync::spawn(async move {
        let mut sound_player_connection_lock = sound_player_connection.lock().await;
        if sound_player_connection_lock.is_none() {
            *sound_player_connection_lock = match service_context_handle
                .lock()
                .await
                .connect::<PlayerMarker>()
                .await
                .context("Connecting to fuchsia.media.sounds.Player")
            {
                Ok(result) => Some(result),
                Err(e) => {
                    fx_log_err!("Failed to connect to fuchsia.media.sounds.Player: {}", e);
                    None
                }
            }
        }
    });
}
/// Establish a connection to the sound player and return the proxy representing the service.
/// Will not do anything if the sound player connection is already established.
Establish a connection to the sound player and return the proxy representing the service.
Will not do anything if the sound player connection is already established.
Establish a connection to the sound player and return the proxy representing the service . Will not do anything if the sound player connection is already established .
fn connect_to_sound_player(
    service_context_handle: ServiceContextHandle,
    sound_player_connection: Arc<Mutex<Option<PlayerProxy>>>,
) {
    fasync::spawn(async move {
        let mut sound_player_connection_lock = sound_player_connection.lock().await;
        if sound_player_connection_lock.is_none() {
            *sound_player_connection_lock = match service_context_handle
                .lock()
                .await
                .connect::<PlayerMarker>()
                .await
                .context("Connecting to fuchsia.media.sounds.Player")
            {
                Ok(result) => Some(result),
                Err(e) => {
                    fx_log_err!("Failed to connect to fuchsia.media.sounds.Player: {}", e);
                    None
                }
            }
        }
    });
}
fn connect_to_sound_player ( service_context_handle : ServiceContextHandle , sound_player_connection : Arc < Mutex < Option < PlayerProxy > > > , ) { fasync :: spawn ( async move { let mut sound_player_connection_lock = sound_player_connection . lock ( ) . await ; if sound_player_connection_lock . is_none ( ) { * sound_player_connection_lock = match service_context_handle . lock ( ) . await . connect :: < PlayerMarker > ( ) . await . context ( " " ) { Ok ( result ) => Some ( result ) , Err ( e ) => { fx_log_err ! ( " " e ) ; None } } } } ) ; }
Establish a connection to the sound player and return the proxy representing the service.
Establish a connection to the sound player and return the proxy representing the service .
service_context_handle
ServiceContextHandle
sound_player_connection
Arc<Mutex<Option<PlayerProxy>>>
service_context_handle
ServiceContextHandle
sound_player_connection
Arc<Mutex<Option<PlayerProxy>>>