From 41a7818b552aef9e6e0bf788089f6ae16ae1e421 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Fri, 26 Aug 2022 23:27:46 -0700 Subject: Mutex wait queues --- include/lib/queue.h | 17 ++--------------- include/util/mutex.h | 2 ++ 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/lib/queue.h b/include/lib/queue.h index 1d4899a..c6da6ed 100644 --- a/include/lib/queue.h +++ b/include/lib/queue.h @@ -1,33 +1,20 @@ #ifndef LIB_QUEUE_H #define LIB_QUEUE_H -enum EntryType { - VALUE_ENTRY = 0, - START_ENTRY = 1, - END_ENTRY = 2, -}; - struct Entry { void* value; struct Entry* next; - unsigned long entry_type; }; struct Queue { struct Entry start; - struct Entry end; }; -// Add to end of queue -void push_to_queue(struct Entry* e, struct Queue* q); // Add to beginning of queue -void prepend_to_queue(struct Entry* e, struct Queue* q); +void push_to_queue(struct Entry* e, struct Queue* q); // Remove from beginning of queue struct Entry* pop_from_queue(struct Queue* q); -// Remove the entry after this one from its queue +// Remove the next entry struct Entry* remove_next_from_queue(struct Entry* e); -// Find an entry in a queue -// Returns the entry before the target entry -struct Entry* find_value(void* value, struct Queue* q); #endif diff --git a/include/util/mutex.h b/include/util/mutex.h index cef4c60..da71146 100644 --- a/include/util/mutex.h +++ b/include/util/mutex.h @@ -16,6 +16,8 @@ struct Mutex { unsigned long pid; void* addr; + struct Entry* locking_thread; + struct Entry* waiting_threads; } __attribute__((packed, aligned(4))); struct MutexManager { -- cgit v1.2.1