1,277
edits
Changes
m
→{{c|KThread.join()}}
===Testing===
* {{c|threadA}} prints out a few statements, calls {{c|threadB.join()}}, then prints out a few more statements. {{c|threadB}} also prints out a series of statements. We then verify that {{c|threadB}} executes contiguously to completion before {{c|threadA}} resumes its execution, as evidenced by the sequence of printed statements.
* Have a thread attempt to {{c|join()}} to itself, call {{c|join() }} on the same (but different) thread multiple times, and attempt to call {{c|join()}} on a finished thread (all separately). These should all return immediately as this is the expected behavior.
* Test a chain of threads. Thread C will attempt to join Thread B. Thread B will attempt to join Thread A. Thread A forks last. Verify that A executes before B, and B executes before C.
}</pre>}}
{{c|<pre>finish(){
// Interrupts have been disabled.
...(existing code)...