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_;
46 for (i = 0; i < 5; i++)
48 printf ("Thread %s iteration %d\n", name, i);
51 printf ("Thread %s done!\n", name);
55 simple_thread_func (void *name_)
57 const char *name = name_;
60 for (i = 0; i < 5; i++)
62 printf ("Thread %s iteration %d\n", name, i);
65 printf ("Thread %s done!\n", name);