aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-19 16:47:22 -0700
committerChristian Cunningham <cc@localhost>2022-02-19 16:47:22 -0700
commit871d1663aba635dd41c48e7def0a58c5267fd1e7 (patch)
tree0f220985396373849f596b3a271d718a413aa774 /src/util
parent9de5e07bc3920d4b03903eb5b78847973075059b (diff)
Commented Scheduler
Temp comment out old mutex locking
Diffstat (limited to 'src/util')
-rw-r--r--src/util/mutex.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/util/mutex.c b/src/util/mutex.c
index 5583d09..995ef62 100644
--- a/src/util/mutex.c
+++ b/src/util/mutex.c
@@ -4,43 +4,43 @@
#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;
-}
+///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)
{