< prev index next >
src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java
Print this page
8200123: Replace Thread.init with telescoping constructor
Reviewed-by: dholmes, mchung, plevart
*** 410,424 ****
}
/**
* Returns the thread id for the given thread. We must access
* this directly rather than via method Thread.getId() because
! * getId() is not final, and has been known to be overridden in
! * ways that do not preserve unique mappings.
*/
static final long getThreadId(Thread thread) {
! return U.getLongVolatile(thread, TID);
}
// Hotspot implementation via intrinsics API
private static final Unsafe U = Unsafe.getUnsafe();
private static final long PARKBLOCKER = U.objectFieldOffset
--- 410,424 ----
}
/**
* Returns the thread id for the given thread. We must access
* this directly rather than via method Thread.getId() because
! * getId() has been known to be overridden in ways that do not
! * preserve unique mappings.
*/
static final long getThreadId(Thread thread) {
! return U.getLong(thread, TID);
}
// Hotspot implementation via intrinsics API
private static final Unsafe U = Unsafe.getUnsafe();
private static final long PARKBLOCKER = U.objectFieldOffset
< prev index next >