I’m reading part 17.2.1 of Java language specification: http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.2.1
I won’t copy a text, it’s too long, but I would like to know, why for third step of sequence they’re saying that
If thread t was removed from m's wait set in step 2 due to an interrupt
Thread couldn’t get to step 2 it wasn’t removed from wait set, because it written for the step 1:
Thread t does not execute any further instructions until it has been removed from m's wait set
Thus thread can’t be removed from wait set in step 2 whatever it’s due to, because it was already removed.
Please help me understand this.
This is a bug caused by mistake in updating from prior version JLS, Third Edition 17.8.1 Wait, missing number of the list item.
Prior version JLS had the respective sequence listed from 1 to 4, not from 1 to 3:
- Thread
t
is added to the wait set…- Thread
t
does not execute any further instructions until…- Thread
t
performs n lock actions….- If thread
t
was removed fromm
‘s wait set in step 2…
As you may see, step 2 in original version document refers to the part other than currently marked 2.
Compared to original version, JLS Java SE 7 Edition 17.2.1. Wait has lost list number (likely lost <li class="listitem">
in html) at the item Thread t
does not execute…
As a result, whole sequence now lists from 1 to 3 and words “step 2” left unchanged from original version refer reader to wrong item that has been previously marked 3, not 2.
That is probably just a typo and is meant to be step 1.
Typos happen even in large projects and where a lot of people work on it.
3