equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
301 } |
301 } |
302 _semaphore.signal(); |
302 _semaphore.signal(); |
303 } |
303 } |
304 |
304 |
305 bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) { |
305 bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) { |
306 // SafepointSynchronize::safepoint_safe() does not consider an externally |
306 // handshake_safe may only be called with polls armed. |
307 // suspended thread to be safe. However, this function must be called with |
307 // VM thread controls this by first claiming the handshake via claim_handshake_for_vmthread. |
308 // the Threads_lock held so an externally suspended thread cannot be |
308 return SafepointSynchronize::handshake_safe(target); |
309 // resumed thus it is safe. |
|
310 assert(Threads_lock->owned_by_self(), "Not holding Threads_lock."); |
|
311 return SafepointSynchronize::safepoint_safe(target, target->thread_state()) || |
|
312 target->is_ext_suspended() || target->is_terminated(); |
|
313 } |
309 } |
314 |
310 |
315 static bool possibly_vmthread_can_process_handshake(JavaThread* target) { |
311 static bool possibly_vmthread_can_process_handshake(JavaThread* target) { |
316 // An externally suspended thread cannot be resumed while the |
312 // An externally suspended thread cannot be resumed while the |
317 // Threads_lock is held so it is safe. |
313 // Threads_lock is held so it is safe. |