X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Ftest.c;h=ae9d16d8e2aba7a3491ba5ea617b85170990e6a8;hb=3b36c59160d9fd64db9c5733c35cba98fa160ec2;hp=ccb2427b28616c66efd9de4c26963b45885571fe;hpb=a9211d5f5546b7b47087850e058ec97e92a85093;p=pintos-anon diff --git a/src/threads/test.c b/src/threads/test.c index ccb2427..ae9d16d 100644 --- a/src/threads/test.c +++ b/src/threads/test.c @@ -25,7 +25,7 @@ struct sleep_thread_data int *product; /* Largest product so far. */ struct lock *lock; /* Lock on access to `product'. */ struct semaphore done; /* Completion semaphore. */ - struct thread *thread; /* Thread. */ + tid_t tid; /* Thread ID. */ }; static void sleeper (void *); @@ -63,14 +63,14 @@ test_sleep (int iterations) t->product = &product; t->lock = &lock; sema_init (&t->done, 0, name); - t->thread = thread_create (name, sleeper, t); + t->tid = thread_create (name, PRI_DEFAULT, sleeper, t); } /* Wait for all the threads to finish. */ for (i = 0; i < thread_cnt; i++) { #ifdef THREAD_JOIN_IMPLEMENTED - thread_join (threads[i].thread); + thread_join (threads[i].tid); #else sema_down (&threads[i].done); #endif @@ -98,13 +98,11 @@ sleeper (void *t_) lock_release (t->lock); printf ("%s: duration=%d, iteration=%d, product=%d\n", - thread_name (thread_current ()), - t->duration, i, new_product); + thread_name (), t->duration, i, new_product); if (old_product > new_product) printf ("%s: Out of order sleep completion (%d > %d)!\n", - thread_name (thread_current ()), - old_product, new_product); + thread_name (), old_product, new_product); } /* Signal completion. */