Java Reference
In-Depth Information
true . This causes the second thread to terminate with its next time slice. Each time through
the loop the string in currentName is checked against the name of the executing thread. If
they don't match, it means that a task-switch occurred. Each time a task-switch happens,
the name of the new thread is displayed, and currentName is given the name of the new
thread. Displaying each thread switch allows you to watch (in a very imprecise way) when
the threads gain access to the CPU. After both threads stop, the number of iterations for
each loop is displayed.
Search WWH ::




Custom Search