aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/globals.h5
-rw-r--r--include/lib/queue.h1
-rw-r--r--include/util/mutex.h7
3 files changed, 11 insertions, 2 deletions
diff --git a/include/globals.h b/include/globals.h
index 24bd4f5..6c7e1f1 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -13,12 +13,13 @@ extern unsigned long nextpid;
extern unsigned long stimel;
extern unsigned long stimeh;
extern struct Scheduler scheduler;
+extern struct MutexManager mutex_manager;
extern struct Thread usrloopthread;
extern unsigned int gwidth, gheight, gpitch, gisrgb;
+extern struct Mutex mutexs[MAX_MUTEXS];
+extern struct Entry mutex_entries[MAX_MUTEXS];
extern struct Thread threads[MAX_THREADS];
extern struct Entry thread_entries[MAX_THREADS];
-extern unsigned long mutex_table[MAX_MUTEXS];
-extern struct Mutex mutexs[MAX_MUTEXS];
#endif
#endif
diff --git a/include/lib/queue.h b/include/lib/queue.h
index 5e57613..1d4899a 100644
--- a/include/lib/queue.h
+++ b/include/lib/queue.h
@@ -27,6 +27,7 @@ struct Entry* pop_from_queue(struct Queue* q);
// Remove the entry after this one from its queue
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 c0dd17b..8ab3235 100644
--- a/include/util/mutex.h
+++ b/include/util/mutex.h
@@ -1,5 +1,6 @@
#ifndef UTIL_MUTEX_H
#define UTIL_MUTEX_H
+#include <lib/queue.h>
#define NULL_PID 0
#define CORE0_PID 1
@@ -17,6 +18,12 @@ struct Mutex {
void* addr;
} __attribute__((packed, aligned(4)));
+struct MutexManager {
+ struct Queue free;
+ struct Queue used;
+};
+
+void mutex_init(void);
struct Mutex* create_mutex(void* addr);
unsigned char delete_mutex(struct Mutex* m);