X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Fsynch.c;h=28696d471aecfc67bfffc243f3734b0dd34a09b2;hb=b1a18e3872d52fcfe598b1e0e0d6698408960ce4;hp=d7601dacddc89f7c772d3340cf0e856b81c82f09;hpb=3625c2e6aba3b282f91282492c4b3fba324816c1;p=pintos-anon diff --git a/src/threads/synch.c b/src/threads/synch.c index d7601da..28696d4 100644 --- a/src/threads/synch.c +++ b/src/threads/synch.c @@ -26,10 +26,11 @@ MODIFICATIONS. */ -#include "synch.h" -#include "interrupt.h" -#include "lib.h" -#include "thread.h" +#include "threads/synch.h" +#include +#include +#include "threads/interrupt.h" +#include "threads/thread.h" /* Initializes semaphore SEMA to VALUE and names it NAME (for debugging purposes only). A semaphore is a nonnegative @@ -105,25 +106,24 @@ sema_name (const struct semaphore *sema) static void sema_test_helper (void *sema_); /* Self-test for semaphores that makes control "ping-pong" - between a pair of threads. Insert calls to printk() to see + between a pair of threads. Insert calls to printf() to see what's going on. */ void sema_self_test (void) { - struct thread *thread; struct semaphore sema[2]; int i; - printk ("Testing semaphores..."); + printf ("Testing semaphores..."); sema_init (&sema[0], 0, "ping"); sema_init (&sema[1], 0, "pong"); - thread = 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]); sema_down (&sema[1]); } - printk ("done.\n"); + printf ("done.\n"); } /* Thread function used by sema_self_test(). */