ASSERT (lock != NULL);
ASSERT (name != NULL);
- strlcpy (lock->name, name, sizeof lock->name);
lock->holder = NULL;
sema_init (&lock->semaphore, 1, name);
}
/* Releases LOCK, which must be owned by the current thread.
An interrupt handler cannot acquire a lock, so it does not
- make sense to try to signal a condition variable within an
- interrupt handler. */
+ make sense to try to release a lock within an interrupt
+ handler. */
void
lock_release (struct lock *lock)
{
{
ASSERT (lock != NULL);
- return lock->name;
+ return sema_name (&lock->semaphore);
}
\f
/* One semaphore in a list. */
}
/* Atomically releases LOCK and waits for COND to be signaled by
- some other piece of code. After COND is signalled, LOCK is
+ some other piece of code. After COND is signaled, LOCK is
reacquired before returning. LOCK must be held before calling
this function.
again.
A given condition variable is associated with only a single
- lock, but one lock may be be associated with any number of
+ lock, but one lock may be associated with any number of
condition variables. That is, there is a one-to-many mapping
from locks to condition variables.