X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Fsynch.h;h=c13f95d8d429a762843824e8c4e70fc1f6d4a799;hb=edc1683ed9dcb006cbdf2d29a970ed1f0a5b843f;hp=c8ac2f446508a793962d455e6d3551e1af56d125;hpb=f2f8875638593bd5365cfd6a5ba7c9578e52322f;p=pintos-anon diff --git a/src/threads/synch.h b/src/threads/synch.h index c8ac2f4..c13f95d 100644 --- a/src/threads/synch.h +++ b/src/threads/synch.h @@ -1,5 +1,5 @@ -#ifndef HEADER_SYNCH_H -#define HEADER_SYNCH_H 1 +#ifndef THREADS_SYNCH_H +#define THREADS_SYNCH_H #include #include @@ -12,7 +12,7 @@ struct semaphore struct list waiters; /* List of waiting threads. */ }; -void sema_init (struct semaphore *, unsigned value, const char *); +void sema_init (struct semaphore *, unsigned value, const char *name); void sema_down (struct semaphore *); void sema_up (struct semaphore *); const char *sema_name (const struct semaphore *); @@ -21,12 +21,11 @@ void sema_self_test (void); /* Lock. */ struct lock { - char name[16]; /* Name (for debugging purposes only). */ struct thread *holder; /* Thread holding lock (for debugging). */ struct semaphore semaphore; /* Binary semaphore controlling access. */ }; -void lock_init (struct lock *, const char *); +void lock_init (struct lock *, const char *name); void lock_acquire (struct lock *); void lock_release (struct lock *); bool lock_held_by_current_thread (const struct lock *); @@ -39,10 +38,10 @@ struct condition struct list waiters; /* List of waiting threads. */ }; -void cond_init (struct condition *, const char *); +void cond_init (struct condition *, const char *name); void cond_wait (struct condition *, struct lock *); void cond_signal (struct condition *, struct lock *); void cond_broadcast (struct condition *, struct lock *); const char *cond_name (const struct condition *); -#endif /* synch.h */ +#endif /* threads/synch.h */