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 multiple_test (void);
21 static thread_func simple_thread_func;
29 "Testing multiple join.\n"
30 "Threads 4 and 5 should finish before thread 6 starts.\n");
32 tid4 = thread_create ("4", PRI_DEFAULT, simple_thread_func, "4");
33 tid5 = thread_create ("5", PRI_DEFAULT, simple_thread_func, "5");
37 simple_thread_func ("6");
38 printf ("Multiple join test done.\n");
42 simple_thread_func (void *name_)
44 const char *name = name_;
47 for (i = 0; i < 5; i++)
49 printf ("Thread %s iteration %d\n", name, i);
52 printf ("Thread %s done!\n", name);