diff options
author | Christian Cunningham <cc@localhost> | 2022-03-10 20:01:25 -0800 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-10 20:01:25 -0800 |
commit | ad9e577e8b2f6431d48a6a64fd95aff432e48441 (patch) | |
tree | 598ade41d70d616cf0891855732c0957835cd465 /src/util/mutex.c | |
parent | 0d80865f669c2314c905f94a4117300a33338792 (diff) |
More Deterministic
Diffstat (limited to 'src/util/mutex.c')
-rw-r--r-- | src/util/mutex.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/util/mutex.c b/src/util/mutex.c index 995ef62..e69de29 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -1,52 +0,0 @@ -#include <cpu/atomic/swap.h> -#include <globals.h> -#include <lib/kmem.h> -#include <sys/schedule.h> -#include <util/mutex.h> - -///unsigned char lock_mutex(struct Mutex* m, unsigned long pid) -///{ -/// if (m->pid == NULL_PID) { -/// // Use currently running thread's PID if no pid given -/// if (pid == 0) { -/// struct Thread* thread = scheduler.rthread; -/// atm_lock(thread->pid, &m->pid); -/// } else { -/// atm_lock(pid, &m->pid); -/// } -/// return 0; -/// } -/// struct Thread* thread = scheduler.rthread; -/// thread->status = THREAD_MWAIT; -/// thread->mptr = m; -/// return 1; -///} -/// -///// Eventually, there will need to be a hook into the scheduling mechanism -///// that checks the currently running process and check that against the -///// mutex's pid lock -///unsigned char release_mutex(struct Mutex* m, unsigned long pid) -///{ -/// // Use current thread's PID if no pid -/// if (pid == 0) { -/// struct Thread* thread = scheduler.rthread; -/// if (m->pid == thread->pid) { -/// atm_release(&m->pid); -/// return 0; -/// } -/// } -/// else if (m->pid == pid) { -/// atm_release(&m->pid); -/// return 0; -/// } -/// return 1; -///} - -struct Mutex* create_mutex(void* addr) -{ - // Ensure aligned to word - Important for Atomic Swap - struct Mutex* m = (struct Mutex*)kmalloc(sizeof(struct Mutex)); - m->addr = addr; - m->pid = 0; - return m; -} |