reader writer lock + small cleanups

This commit is contained in:
Remzi H. Arpaci-Dusseau
2019-04-22 13:14:08 -05:00
parent d532b42eda
commit b4fa80ad67
5 changed files with 109 additions and 4 deletions

View File

@@ -40,13 +40,14 @@ void eat() {
void *philosopher(void *arg) {
arg_t *args = (arg_t *) arg;
int p = args->thread_id;
int i;
for (i = 0; i < args->num_loops; i++) {
think();
get_forks(args->thread_id);
get_forks(p);
eat();
put_forks(args->thread_id);
put_forks(p);
}
return NULL;
}