refacto async mutex usage
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2022-12-21 20:36:18 +01:00
parent b9544293e5
commit ab79782a78
2 changed files with 6 additions and 8 deletions

@ -67,8 +67,7 @@ lazy_static! {
pub async fn init() {
println!("Detecting drives");
let guard = DRIVE.lock().await;
match guard.as_ref() {
match DRIVE.lock().await.as_ref() {
None => println!("No drive detected :("),
Some(drive) => {
let drive_type = match drive.current_drive {
@ -324,7 +323,6 @@ impl ATABus {
pub async fn print_block() {
let mut guard = DRIVE.lock().await;
guard.as_mut().unwrap().read_block(500).await;
serial_println!("{:x?}", guard.as_mut().unwrap().block);
let block = DRIVE.lock().await.as_mut().unwrap().read_block(500).await;
serial_println!("{:x?}", block);
}

@ -6,10 +6,10 @@ use crate::utils::unserialize;
use iso9660::{IsoPrimVolDesc};
pub async fn init_prim_vol_desc() {
let mut guard = DRIVE
let desc_block = DRIVE
.lock()
.await;
let desc_block = guard.as_mut()
.await
.as_mut()
.unwrap()
.read_block(iso9660::ISO_PRIM_VOLDESC_BLOCK)
.await;