From dda1706dc935362816d3be3ddfd8be0b4c8968af Mon Sep 17 00:00:00 2001 From: Andrea Ciliberti Date: Thu, 10 Mar 2022 19:20:22 +0100 Subject: [PATCH] Missed ordering changes --- ctru-rs/src/gfx.rs | 2 +- ctru-rs/src/romfs.rs | 2 +- ctru-rs/src/services/apt.rs | 2 +- ctru-rs/src/services/fs.rs | 2 +- ctru-rs/src/services/hid.rs | 2 +- ctru-rs/src/services/soc.rs | 2 +- ctru-rs/src/services/sslc.rs | 2 +- ctru-rs/src/srv.rs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ctru-rs/src/gfx.rs b/ctru-rs/src/gfx.rs index b03e64d..0d244c1 100644 --- a/ctru-rs/src/gfx.rs +++ b/ctru-rs/src/gfx.rs @@ -86,7 +86,7 @@ impl Gfx { bottom_fb_fmt: FramebufferFormat, use_vram_buffers: bool, ) -> Result { - match GFX_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match GFX_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { unsafe { ctru_sys::gfxInit(top_fb_fmt.into(), bottom_fb_fmt.into(), use_vram_buffers); diff --git a/ctru-rs/src/romfs.rs b/ctru-rs/src/romfs.rs index f09c25e..78005fc 100644 --- a/ctru-rs/src/romfs.rs +++ b/ctru-rs/src/romfs.rs @@ -22,7 +22,7 @@ static ROMFS_ACTIVE: AtomicBool = AtomicBool::new(false); impl RomFS { pub fn init() -> crate::Result { - match ROMFS_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match ROMFS_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { let mount_name = CStr::from_bytes_with_nul(b"romfs\0").unwrap(); let result = unsafe { ctru_sys::romfsMountSelf(mount_name.as_ptr()) }; diff --git a/ctru-rs/src/services/apt.rs b/ctru-rs/src/services/apt.rs index 85fb710..29ab58c 100644 --- a/ctru-rs/src/services/apt.rs +++ b/ctru-rs/src/services/apt.rs @@ -9,7 +9,7 @@ static APT_ACTIVE: AtomicBool = AtomicBool::new(false); impl Apt { pub fn init() -> crate::Result { - match APT_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match APT_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { let r = unsafe { ctru_sys::aptInit() }; if r < 0 { diff --git a/ctru-rs/src/services/fs.rs b/ctru-rs/src/services/fs.rs index b4c7cfa..cd8fc20 100644 --- a/ctru-rs/src/services/fs.rs +++ b/ctru-rs/src/services/fs.rs @@ -308,7 +308,7 @@ impl Fs { /// as many times as desired and the service will not exit until all /// instances of Fs drop out of scope. pub fn init() -> crate::Result { - match FS_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match FS_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { let r = unsafe { ctru_sys::fsInit() }; if r < 0 { diff --git a/ctru-rs/src/services/hid.rs b/ctru-rs/src/services/hid.rs index bbeefb4..567849f 100644 --- a/ctru-rs/src/services/hid.rs +++ b/ctru-rs/src/services/hid.rs @@ -70,7 +70,7 @@ pub struct CirclePosition(ctru_sys::circlePosition); /// rare in practice. impl Hid { pub fn init() -> crate::Result { - match HID_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match HID_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { let r = unsafe { ctru_sys::hidInit() }; if r < 0 { diff --git a/ctru-rs/src/services/soc.rs b/ctru-rs/src/services/soc.rs index 3bad215..e04e040 100644 --- a/ctru-rs/src/services/soc.rs +++ b/ctru-rs/src/services/soc.rs @@ -31,7 +31,7 @@ impl Soc { /// /// This function will return an error if the `Soc` service is already initialized pub fn init_with_buffer_size(num_bytes: usize) -> crate::Result { - match SOC_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match SOC_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => unsafe { let soc_mem = memalign(0x1000, num_bytes) as *mut u32; diff --git a/ctru-rs/src/services/sslc.rs b/ctru-rs/src/services/sslc.rs index 4778819..0ee2661 100644 --- a/ctru-rs/src/services/sslc.rs +++ b/ctru-rs/src/services/sslc.rs @@ -12,7 +12,7 @@ static SSLC_ACTIVE: AtomicBool = AtomicBool::new(false); impl SslC { /// Initialize sslc pub fn init() -> crate::Result { - match SSLC_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match SSLC_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { let r = unsafe { ctru_sys::sslcInit(0) }; if r < 0 { diff --git a/ctru-rs/src/srv.rs b/ctru-rs/src/srv.rs index d817b94..5445066 100644 --- a/ctru-rs/src/srv.rs +++ b/ctru-rs/src/srv.rs @@ -9,7 +9,7 @@ static SRV_ACTIVE: AtomicBool = AtomicBool::new(false); impl Srv { pub fn init() -> crate::Result { - match SRV_ACTIVE.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) { + match SRV_ACTIVE.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) { Ok(_) => { let r = unsafe { ctru_sys::srvInit() }; if r < 0 {