< prev index next >
src/hotspot/share/runtime/handshake.hpp
Print this page
*** 35,45 ****
// 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.
class HandshakeClosure : public ThreadClosure {
const char* const _name;
public:
HandshakeClosure(const char* name) : _name(name) {}
const char* name() const {
--- 35,48 ----
// 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 wether 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 {
*** 47,67 ****
}
virtual void do_thread(Thread* thread) = 0;
};
class Handshake : public AllStatic {
- static void direct_handshake(JavaThread* target, HandshakeOperation *op);
public:
// Execution of handshake operation
static void execute(HandshakeClosure* hs_cl);
! static bool execute(HandshakeClosure* hs_cl, JavaThread* target, bool is_direct_handshake = false);
};
// The HandshakeState keep tracks of an ongoing handshake for one JavaThread.
! // VM thread and JavaThread are serialized with the semaphore making sure
! // the operation is only done by either VM thread on behalf of the JavaThread
! // or the JavaThread itself.
class HandshakeState {
JavaThread *_thread;
HandshakeOperation* volatile _operation;
HandshakeOperation* volatile _operation_direct;
--- 50,70 ----
}
virtual void do_thread(Thread* thread) = 0;
};
class Handshake : public AllStatic {
public:
// Execution of handshake operation
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;
*** 81,90 ****
--- 84,96 ----
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;
+ }
void process_by_self() {
if (!_thread_in_process_handshake) {
FlagSetting fs(_thread_in_process_handshake, true);
process_self_inner();
< prev index next >