From 7368140be0e17f19300b53c5df77cf18aab45cff Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 18 Mar 2022 20:01:51 -0700 Subject: Fixed Mutex Deletion Logic --- src/util/mutex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/mutex.c b/src/util/mutex.c index 802558e..0525a3e 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -10,7 +10,7 @@ void mutex_init(void) mutexs[m].addr = 0; mutex_entries[m].value = &mutexs[m]; mutex_entries[m].entry_type = VALUE_ENTRY; - mutex_entries[m].next = &mutex_entries[(m+1)%MAX_MUTEXS]; + mutex_entries[m].next = &mutex_entries[m+1]; } // Initialize Free Mutexs mutex_manager.free.start.value = 0; @@ -47,9 +47,9 @@ unsigned char delete_mutex(struct Mutex* m) if (entry == 0) return 1; // Remove it from the queue - remove_next_from_queue(entry); + struct Entry* theentry = remove_next_from_queue(entry); // Add it to the free queue - prepend_to_queue(entry, &mutex_manager.free); + prepend_to_queue(theentry, &mutex_manager.free); return 0; } -- cgit v1.2.1