< prev index next >
src/hotspot/share/runtime/handshake.hpp
Print this page
*** 28,48 ****
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
#include "runtime/flags/flagSetting.hpp"
#include "runtime/semaphore.hpp"
- class JavaThread;
class HandshakeOperation;
// A handshake closure is a callback that is executed for each JavaThread
// while that thread is in a safepoint safe state. The callback is executed
! // either by the thread itself or by the VM thread while keeping the thread
! // in a blocked state. A handshake can be performed with a single
! // JavaThread as well. In that case the callback is executed either by the
! // thread itself or, depending on whether the operation is a direct handshake
! // or not, by the JavaThread that requested the handshake or the VMThread
! // respectively.
class HandshakeClosure : public ThreadClosure {
const char* const _name;
public:
HandshakeClosure(const char* name) : _name(name) {}
const char* name() const {
--- 28,48 ----
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
#include "runtime/flags/flagSetting.hpp"
#include "runtime/semaphore.hpp"
class HandshakeOperation;
+ class JavaThread;
// A handshake closure is a callback that is executed for each JavaThread
// while that thread is in a safepoint safe state. The callback is executed
! // either by the target JavaThread itself or by the VMThread while keeping
! // the target thread in a blocked state. A handshake can be performed with a
! // single JavaThread as well. In that case, the callback is executed either
! // by the target JavaThread itself or, depending on whether the operation is
! // a direct handshake or not, by the JavaThread that requested the handshake
! // or the VMThread respectively.
class HandshakeClosure : public ThreadClosure {
const char* const _name;
public:
HandshakeClosure(const char* name) : _name(name) {}
const char* name() const {
*** 57,76 ****
static void execute(HandshakeClosure* hs_cl);
static bool execute(HandshakeClosure* hs_cl, JavaThread* target);
static bool execute_direct(HandshakeClosure* hs_cl, JavaThread* target);
};
! // The HandshakeState keep tracks of an ongoing handshake for one JavaThread.
! // VMThread/Handshaker and JavaThread are serialized with the semaphore making
! // sure the operation is only done by either VMThread/Handshaker on behalf of
! // the JavaThread or the JavaThread itself.
class HandshakeState {
! JavaThread *_thread;
HandshakeOperation* volatile _operation;
HandshakeOperation* volatile _operation_direct;
! Semaphore _handshake_turn_sem;
Semaphore _processing_sem;
bool _thread_in_process_handshake;
bool claim_handshake(bool is_direct);
bool possibly_can_process_handshake();
--- 57,76 ----
static void execute(HandshakeClosure* hs_cl);
static bool execute(HandshakeClosure* hs_cl, JavaThread* target);
static bool execute_direct(HandshakeClosure* hs_cl, JavaThread* target);
};
! // The HandshakeState keeps track of an ongoing handshake for this JavaThread.
! // VMThread/Handshaker and JavaThread are serialized with semaphore _processing_sem
! // making sure the operation is only done by either VMThread/Handshaker on behalf
! // of the JavaThread or by the target JavaThread itself.
class HandshakeState {
! JavaThread* _handshakee;
HandshakeOperation* volatile _operation;
HandshakeOperation* volatile _operation_direct;
! Semaphore _handshake_turn_sem; // Used to serialize direct handshakes for this JavaThread.
Semaphore _processing_sem;
bool _thread_in_process_handshake;
bool claim_handshake(bool is_direct);
bool possibly_can_process_handshake();
*** 80,90 ****
void process_self_inner();
public:
HandshakeState();
! void set_thread(JavaThread *thread) { _thread = thread; }
void set_operation(HandshakeOperation* op);
bool has_operation() const { return _operation != NULL || _operation_direct != NULL; }
bool has_specific_operation(bool is_direct) const {
return is_direct ? _operation_direct != NULL : _operation != NULL;
--- 80,90 ----
void process_self_inner();
public:
HandshakeState();
! void set_thread(JavaThread* thread) { _handshakee = thread; }
void set_operation(HandshakeOperation* op);
bool has_operation() const { return _operation != NULL || _operation_direct != NULL; }
bool has_specific_operation(bool is_direct) const {
return is_direct ? _operation_direct != NULL : _operation != NULL;
< prev index next >