< prev index next >

src/hotspot/share/runtime/handshake.cpp

Print this page
rev 47863 : imported patch 10.08.open.rebase_20171114.rehn
rev 47865 : dholmes CR: Fix indents, trailing spaces and various typos. Add descriptions for the '_cnt', '_max' and '_times" fields, add impl notes to document the type choices.

*** 135,160 **** if (handshake_has_timed_out(start_time)) { handle_timeout(); } // We need to re-think this with SMR ThreadsList. ! // There is assumption in code that Threads_lock should be lock ! // during certain phases. MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); ThreadsListHandle tlh; if (tlh.includes(_target)) { ! // Warning threads address might be re-used. ! // handshake_process_by_vmthread will check the semaphore for us again ! // Since we can't have more then one handshake in flight a reuse of thread address ! // should be okey since the new thread will not have an operation. _target->handshake_process_by_vmthread(); } else { ! // We can't warn here is since the thread do cancel_handshake after it have been removed ! // from ThreadsList. So we should just keep looping here until while below return negative ! // If we have a bug, then we deadlock here, which is good for debugging. } - } while (!poll_for_completed_thread()); } VMOp_Type type() const { return VMOp_HandshakeOneThread; } --- 135,161 ---- if (handshake_has_timed_out(start_time)) { handle_timeout(); } // We need to re-think this with SMR ThreadsList. ! // There is an assumption in the code that the Threads_lock should be ! // locked during certain phases. MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); ThreadsListHandle tlh; if (tlh.includes(_target)) { ! // Warning _target's address might be re-used. ! // handshake_process_by_vmthread will check the semaphore for us again. ! // Since we can't have more then one handshake in flight a reuse of ! // _target's address should be okay since the new thread will not have ! // an operation. _target->handshake_process_by_vmthread(); } else { ! // We can't warn here since the thread does cancel_handshake after ! // it has been removed from the ThreadsList. So we should just keep ! // looping here until while below returns false. If we have a bug, ! // then we hang here, which is good for debugging. } } while (!poll_for_completed_thread()); } VMOp_Type type() const { return VMOp_HandshakeOneThread; }
*** 195,210 **** // Have VM thread perform the handshake operation for blocked threads. // Observing a blocked state may of course be transient but the processing is guarded // by semaphores and we optimistically begin by working on the blocked threads { // We need to re-think this with SMR ThreadsList. ! // There is assumption in code that Threads_lock should be lock ! // during certain phases. MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thr = jtiwh.next(); ) { ! // A new thread on the ThreadsList will not have an operation. ! // Hence is skipped in handshake_process_by_vmthread. thr->handshake_process_by_vmthread(); } } while (poll_for_completed_thread()) { --- 196,211 ---- // Have VM thread perform the handshake operation for blocked threads. // Observing a blocked state may of course be transient but the processing is guarded // by semaphores and we optimistically begin by working on the blocked threads { // We need to re-think this with SMR ThreadsList. ! // There is an assumption in the code that the Threads_lock should ! // be locked during certain phases. MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thr = jtiwh.next(); ) { ! // A new thread on the ThreadsList will not have an operation, ! // hence it is skipped in handshake_process_by_vmthread. thr->handshake_process_by_vmthread(); } } while (poll_for_completed_thread()) {
< prev index next >