Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

step back...

  • Loading branch information...
commit 5d49601a4c6a18f71af4fda4a2c3dcff3520d2ed 1 parent a2b1869
@grantborthwick authored
Showing with 2 additions and 8 deletions.
  1. +2 −8 src/threads/synch.c
View
10 src/threads/synch.c
@@ -222,27 +222,21 @@ lock_init (struct lock *lock)
void
lock_acquire (struct lock *lock)
{
- enum intr_level old_level;
ASSERT (lock != NULL);
ASSERT (!intr_context ());
ASSERT (!lock_held_by_current_thread (lock));
+ thread_current ()->want_lock = lock;
if ((lock->holder)!= NULL){
- thread_current ()->want_lock = lock;
struct thread* donee = lock->holder;
thread_current ()->donee = donee;
list_push_front(&donee->benefactors, thread_current ());
}
- //thread_recompute_priority(thread_current ()->donee);
sema_down (&lock->semaphore);
-
- //old_level = intr_disable ();
- //list_remove(
- //thread_recompute_priority(thread_current ()->donee);
+ //threads clear benefactors as they get rid of lock!
thread_current ()->donee = NULL;
thread_current ()->want_lock = NULL;
lock->holder = thread_current ();
- //intr_set_level (old_level);
}
/* Tries to acquires LOCK and returns true if successful or false
Please sign in to comment.
Something went wrong with that request. Please try again.