1,277
edits
Changes
m
→Implementation: restore formatting
==KThread.join()==
===Implementation===
{{c|KThread }} has a new state variable {{c|joinedOnMe}}, a {{c|ThreadQueue, and isJoined, a boolean}}.* When {{c|threadA }} calls {{c|threadB.join()}}, thread B {{c|threadB}} adds it to its internal {{c|joinedOnMe }} queue and then puts it to sleep. In the {{c|threadB}}'s {{c|finish() }} method, {{c|threadB}} calls ready on the {{c|nextThread() }} on its {{c|joinedOnMe }} queue before returning. * Join{{c|join() }} also checks that this thread is not equal to the current thread and that {{c|joinedOnMe }} is not already occupied by another thread with a boolean flag , which determines whether {{c|join() }} has already been called on this thread.
===Testing===