From c6a78e2502fd3f7deabecbf48970f346424106f6 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sun, 30 Nov 2025 18:26:31 -0500 Subject: Pass on atomic usage Signed-off-by: Andrew Opalach --- src/cache/handlers/cdio.c | 14 +++++++------- src/cache/handlers/cdio.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cache/handlers') diff --git a/src/cache/handlers/cdio.c b/src/cache/handlers/cdio.c index a9e3747..8326868 100644 --- a/src/cache/handlers/cdio.c +++ b/src/cache/handlers/cdio.c @@ -42,7 +42,7 @@ static nn_thread_result NNWT_THREADCALL cd_read_thread(void *userdata) nn_thread_set_name("cdio_read"); for (;;) { - if (!al_atomic_load(s32)(&cdio->running, AL_ATOMIC_RELAXED)) { + if (!atomic_load(bool)(&cdio->running, AL_ATOMIC_RELAXED)) { // We don't care about how complete the read was. return 0; } @@ -88,13 +88,13 @@ static void handler_cdio_maybe_spawn_worker(struct cch_handler *handler, size_t { struct cch_handler_cdio *cdio = (struct cch_handler_cdio *)handler; if (cdio->start == (lsn_t)index) return; - if (al_atomic_load(s32)(&cdio->running, AL_ATOMIC_ACQUIRE)) { - al_atomic_store(s32)(&cdio->running, 0, AL_ATOMIC_RELEASE); + if (atomic_load(bool)(&cdio->running, AL_ATOMIC_ACQUIRE)) { + atomic_store(bool)(&cdio->running, false, AL_ATOMIC_RELEASE); nn_thread_join(&cdio->thread); } cdio->start = index; cdio->sector = cdio->start; - al_atomic_store(s32)(&cdio->running, 1, AL_ATOMIC_RELEASE); + atomic_store(bool)(&cdio->running, true, AL_ATOMIC_RELEASE); nn_thread_create(&cdio->thread, cd_read_thread, cdio); } @@ -114,8 +114,8 @@ static void handler_cdio_free(struct cch_handler **handler) { struct cch_handler_cdio *cdio = (struct cch_handler_cdio *)*handler; cch_threaded_waits_disable_all(&cdio->waits); - if (al_atomic_load(s32)(&cdio->running, AL_ATOMIC_RELAXED)) { - al_atomic_store(s32)(&cdio->running, 0, AL_ATOMIC_RELAXED); + if (atomic_load(bool)(&cdio->running, AL_ATOMIC_RELAXED)) { + atomic_store(bool)(&cdio->running, false, AL_ATOMIC_RELAXED); nn_thread_join(&cdio->thread); } if (cdio->drive) { @@ -209,7 +209,7 @@ struct cch_entry *cch_handler_cdio_create(void) if (!open_cd_drive(cdio)) { return NULL; } - al_atomic_store(s32)(&cdio->running, 0, AL_ATOMIC_RELAXED); + atomic_store(bool)(&cdio->running, false, AL_ATOMIC_RELAXED); nn_buffer_init(&cdio->buffer); nn_buffer_ensure_space(&cdio->buffer, BYTES_PER_STEP); cdio->buffer.size = BYTES_PER_STEP; diff --git a/src/cache/handlers/cdio.h b/src/cache/handlers/cdio.h index a2734ca..6ef37b9 100644 --- a/src/cache/handlers/cdio.h +++ b/src/cache/handlers/cdio.h @@ -15,7 +15,7 @@ struct cch_handler_cdio { lsn_t end; lsn_t sector; struct nn_buffer buffer; - atomic(s32) running; + atomic(bool) running; struct nn_thread thread; struct cch_threaded_waits waits; }; -- cgit v1.2.3-101-g0448