printf ("Testing semaphores...");
sema_init (&sema[0], 0, "ping");
sema_init (&sema[1], 0, "pong");
- thread_create ("sema-test", sema_test_helper, &sema);
+ thread_create ("sema-test", PRI_DEFAULT, sema_test_helper, &sema);
for (i = 0; i < 10; i++)
{
sema_up (&sema[0]);
ASSERT (lock != NULL);
ASSERT (name != NULL);
- strlcpy (lock->name, name, sizeof lock->name);
lock->holder = NULL;
sema_init (&lock->semaphore, 1, name);
}
{
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.