projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fully capitalize SYS_* syscall enum names.
[pintos-anon]
/
src
/
threads
/
synch.c
diff --git
a/src/threads/synch.c
b/src/threads/synch.c
index 5ec14abf8d4dfa11851e02917a1d030540a560f0..c2764bc38d1cdb3b47efb0f0a43f8d694d493947 100644
(file)
--- a/
src/threads/synch.c
+++ b/
src/threads/synch.c
@@
-192,16
+192,12
@@
lock_init (struct lock *lock)
void
lock_acquire (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));
ASSERT (lock != NULL);
ASSERT (!intr_context ());
ASSERT (!lock_held_by_current_thread (lock));
- old_level = intr_disable ();
sema_down (&lock->semaphore);
lock->holder = thread_current ();
sema_down (&lock->semaphore);
lock->holder = thread_current ();
- intr_set_level (old_level);
}
/* Tries to acquires LOCK and returns true if successful or false
}
/* Tries to acquires LOCK and returns true if successful or false
@@
-213,18
+209,14
@@
lock_acquire (struct lock *lock)
bool
lock_try_acquire (struct lock *lock)
{
bool
lock_try_acquire (struct lock *lock)
{
- enum intr_level old_level;
bool success;
ASSERT (lock != NULL);
ASSERT (!lock_held_by_current_thread (lock));
bool success;
ASSERT (lock != NULL);
ASSERT (!lock_held_by_current_thread (lock));
- old_level = intr_disable ();
success = sema_try_down (&lock->semaphore);
if (success)
lock->holder = thread_current ();
success = sema_try_down (&lock->semaphore);
if (success)
lock->holder = thread_current ();
- intr_set_level (old_level);
-
return success;
}
return success;
}
@@
-236,15
+228,11
@@
lock_try_acquire (struct lock *lock)
void
lock_release (struct lock *lock)
{
void
lock_release (struct lock *lock)
{
- enum intr_level old_level;
-
ASSERT (lock != NULL);
ASSERT (lock_held_by_current_thread (lock));
ASSERT (lock != NULL);
ASSERT (lock_held_by_current_thread (lock));
- old_level = intr_disable ();
lock->holder = NULL;
sema_up (&lock->semaphore);
lock->holder = NULL;
sema_up (&lock->semaphore);
- intr_set_level (old_level);
}
/* Returns true if the current thread holds LOCK, false
}
/* Returns true if the current thread holds LOCK, false