Format fix.

This commit is contained in:
Geoffrey Challen 2015-12-31 11:43:01 -05:00
parent d97a4ae026
commit d733b140f3

View File

@ -44,10 +44,10 @@
* internally. * internally.
*/ */
struct semaphore { struct semaphore {
char *sem_name; char *sem_name;
struct wchan *sem_wchan; struct wchan *sem_wchan;
struct spinlock sem_lock; struct spinlock sem_lock;
volatile unsigned sem_count; volatile unsigned sem_count;
}; };
struct semaphore *sem_create(const char *name, unsigned initial_count); struct semaphore *sem_create(const char *name, unsigned initial_count);
@ -56,7 +56,7 @@ void sem_destroy(struct semaphore *);
/* /*
* Operations (both atomic): * Operations (both atomic):
* P (proberen): decrement count. If the count is 0, block until * P (proberen): decrement count. If the count is 0, block until
* the count is 1 again before decrementing. * the count is 1 again before decrementing.
* V (verhogen): increment count. * V (verhogen): increment count.
*/ */
void P(struct semaphore *); void P(struct semaphore *);
@ -73,9 +73,9 @@ void V(struct semaphore *);
* (should be) made internally. * (should be) made internally.
*/ */
struct lock { struct lock {
char *lk_name; char *lk_name;
// add what you need here // add what you need here
// (don't forget to mark things volatile as needed) // (don't forget to mark things volatile as needed)
}; };
struct lock *lock_create(const char *name); struct lock *lock_create(const char *name);
@ -84,11 +84,11 @@ void lock_destroy(struct lock *);
/* /*
* Operations: * Operations:
* lock_acquire - Get the lock. Only one thread can hold the lock at the * lock_acquire - Get the lock. Only one thread can hold the lock at the
* same time. * same time.
* lock_release - Free the lock. Only the thread holding the lock may do * lock_release - Free the lock. Only the thread holding the lock may do
* this. * this.
* lock_do_i_hold - Return true if the current thread holds the lock; * lock_do_i_hold - Return true if the current thread holds the lock;
* false otherwise. * false otherwise.
* *
* These operations must be atomic. You get to write them. * These operations must be atomic. You get to write them.
*/ */
@ -112,9 +112,9 @@ bool lock_do_i_hold(struct lock *);
*/ */
struct cv { struct cv {
char *cv_name; char *cv_name;
// add what you need here // add what you need here
// (don't forget to mark things volatile as needed) // (don't forget to mark things volatile as needed)
}; };
struct cv *cv_create(const char *name); struct cv *cv_create(const char *name);
@ -122,8 +122,8 @@ void cv_destroy(struct cv *);
/* /*
* Operations: * Operations:
* cv_wait - Release the supplied lock, go to sleep, and, after * cv_wait - Release the supplied lock, go to sleep, and, after
* waking up again, re-acquire the lock. * waking up again, re-acquire the lock.
* cv_signal - Wake up one thread that's sleeping on this CV. * cv_signal - Wake up one thread that's sleeping on this CV.
* cv_broadcast - Wake up all threads sleeping on this CV. * cv_broadcast - Wake up all threads sleeping on this CV.
* *