diff options
author | Christian Cunningham <cc@localhost> | 2022-01-21 11:37:49 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-01-21 11:37:49 -0700 |
commit | 00660fb9143daf7fa04647bccd6047b9bf0f5e48 (patch) | |
tree | 804fd0acb47dbd6b6f7120653c9ab58d5498328c /src/util | |
parent | 0ff3f3c6f0773c7023b86bc829ff607e934bc2dc (diff) |
Scheduler Rewrite Start
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/mutex.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/util/mutex.c b/src/util/mutex.c index f97760b..0e1c816 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -9,16 +9,16 @@ 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_ll->data; - atm_lock(thread->data.pid, &m->pid); + struct Thread* thread = scheduler.rthread; + atm_lock(thread->pid, &m->pid); } else { atm_lock(pid, &m->pid); } return 0; } - struct Thread* thread = scheduler.rthread_ll->data; - thread->data.status = THREAD_WAITING_FOR_MUTEX; - thread->data.mutex_waiting = m; + struct Thread* thread = scheduler.rthread; + thread->status = THREAD_MWAIT; + thread->mptr = m; return 1; } @@ -29,8 +29,8 @@ 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_ll->data; - if (m->pid == thread->data.pid) { + struct Thread* thread = scheduler.rthread; + if (m->pid == thread->pid) { atm_release(&m->pid); return 0; } |