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 simple_test (void);
21 static thread_func simple_thread_func;
29 "Testing simple join.\n"
30 "Thread 0 should finish before thread 1 starts.\n");
31 tid0 = thread_create ("0", PRI_DEFAULT, simple_thread_func, "0");
34 simple_thread_func ("1");
35 printf ("Simple join test done.\n");
39 simple_thread_func (void *name_)
41 const char *name = name_;
44 for (i = 0; i < 5; i++)
46 printf ("Thread %s iteration %d\n", name, i);
49 printf ("Thread %s done!\n", name);