Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
17, 20, 21
-
b17
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8310270 | 20u-cpu | Ivan Bereziuk | P4 | Resolved | Fixed | master |
JDK-8310325 | 17.0.9-oracle | Ivan Bereziuk | P4 | Resolved | Fixed | b01 |
JDK-8311036 | 17.0.9 | Aleksey Shipilev | P4 | Resolved | Fixed | b01 |
Description
synchronized boolean alive() {
return eetop != 0;
}
Why the VM call was ever performed is lost in history. In JDK 1.1 the code was completely different. In JDK 1.2 we have essentially the same code as today.
The synchronized is needed to ensure thread terminations Happens-before isAlive() returns false. And it also guards against the field check being hoisted in a loop like: while (t.isAlive() ...
EDIT: The actual fix used a volatile eetop rather than synchronized in isAlive. The VM also treats eetop like a volatile and does the necessary `release` operation to create the required happens-before ordering.
Attachments
Issue Links
- backported by
-
JDK-8310270 Thread.isAlive0 doesn't need to call into the VM
- Resolved
-
JDK-8310325 Thread.isAlive0 doesn't need to call into the VM
- Resolved
-
JDK-8311036 Thread.isAlive0 doesn't need to call into the VM
- Resolved
- relates to
-
JDK-8306452 Fix Amazon copyright in JDK-8305425 test
- Resolved
-
JDK-8317834 java/lang/Thread/IsAlive.java timed out
- Resolved
- links to
-
Commit openjdk/jdk17u-dev/4fd0ee52
-
Commit openjdk/jdk/35cb303a
-
Review openjdk/jdk17u-dev/1425
-
Review openjdk/jdk/13287