8234796: Refactor Handshake::execute to take a more complex type than ThreadClosure

Reviewed-by: dholmes, pliden, coleenp
This commit is contained in:
Robbin Ehn 2019-12-03 15:32:41 +01:00
parent 095d77acf0
commit 21e03e71aa
36 changed files with 95 additions and 50 deletions

View file

@ -26,22 +26,32 @@
#define SHARE_RUNTIME_HANDSHAKE_HPP
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
#include "runtime/flags/flagSetting.hpp"
#include "runtime/semaphore.hpp"
class ThreadClosure;
class JavaThread;
// A handshake operation is a callback that is executed for each 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 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 {
return _name;
}
virtual void do_thread(Thread* thread) = 0;
};
class Handshake : public AllStatic {
public:
// Execution of handshake operation
static void execute(ThreadClosure* thread_cl);
static bool execute(ThreadClosure* thread_cl, JavaThread* target);
static void execute(HandshakeClosure* hs_cl);
static bool execute(HandshakeClosure* hs_cl, JavaThread* target);
};
class HandshakeOperation;