1 /* Problem 1-2: Join tests.
3 Based on a test originally submitted for Stanford's CS 140 in
4 winter 1998 by Rob Baesman <rbaesman@cs.stanford.edu>, Ben
5 Taskar <btaskar@cs.stanford.edu>, and Toli Kuznets
6 <tolik@cs.stanford.edu>. Later modified by shiangc, yph, and
8 #include "threads/test.h"
10 #include "threads/interrupt.h"
11 #include "threads/thread.h"
13 static void quick_test (void);
21 static thread_func quick_thread_func;
22 static thread_func simple_thread_func;
30 "Testing quick join.\n"
31 "Thread 2 should finish before thread 3 starts.\n");
33 tid2 = thread_create ("2", PRI_DEFAULT, quick_thread_func, "2");
36 simple_thread_func ("3");
37 printf ("Quick join test done.\n");
41 quick_thread_func (void *name_)
43 const char *name = name_;
48 for (i = 0; i < 5; i++)
50 printf ("Thread %s iteration %d\n", name, i);
53 printf ("Thread %s done!\n", name);
57 simple_thread_func (void *name_)
59 const char *name = name_;
62 for (i = 0; i < 5; i++)
64 printf ("Thread %s iteration %d\n", name, i);
67 printf ("Thread %s done!\n", name);