RFR: 8230424: Use platform independent code for Thread.interrupt support

Robbin Ehn robbin.ehn at oracle.com
Tue Sep 17 12:05:12 UTC 2019


Hi David,

Nit, double indent on if-statement here:
src/hotspot/share/runtime/thread.cpp
+void JavaThread::interrupt() {
+  debug_only(check_for_dangling_thread_pointer(this);)
+
+    if (!osthread()->interrupted()) {

> If you are wondering why Windows used OrderAccess::release while POSIX used OrderAccess::fence, I have no idea, and I do 
> not intend to change either of them. The only safe change would be to use fence() in both cases, which just makes the 
> Windows wart worse - and unnecessarily so as we have seen no bugs using the existing release().

unpark() do Atomic::xchg, so fence is not needed.
SetEvent is a syscall, so release is not needed.
No need to change, you can leave them as is.

Looks good, thanks! (no need for an update)

/Robbin


> 
> Testing:
>   - hotspot runtime
>   - Tiers 1-3
> 
> Thanks,
> David


More information about the hotspot-dev mailing list