< prev index next >

src/hotspot/share/runtime/handshake.hpp

Print this page




  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_RUNTIME_HANDSHAKE_HPP
  26 #define SHARE_RUNTIME_HANDSHAKE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "runtime/flags/flagSetting.hpp"
  31 #include "runtime/semaphore.hpp"
  32 
  33 class JavaThread;
  34 class HandshakeOperation;
  35 
  36 // A handshake closure is a callback that is executed for each JavaThread
  37 // while that thread is in a safepoint safe state. The callback is executed
  38 // either by the thread itself or by the VM thread while keeping the thread
  39 // in a blocked state. A handshake can be performed with a single
  40 // JavaThread as well. In that case the callback is executed either by the
  41 // thread itself or, depending on wether the operation is a direct handshake
  42 // or not, by the JavaThread that requested the handshake or the VMThread
  43 // respectively.
  44 class HandshakeClosure : public ThreadClosure {
  45   const char* const _name;
  46  public:
  47   HandshakeClosure(const char* name) : _name(name) {}
  48   const char* name() const {
  49     return _name;
  50   }
  51   virtual void do_thread(Thread* thread) = 0;
  52 };
  53 
  54 class Handshake : public AllStatic {
  55  public:
  56   // Execution of handshake operation
  57   static void execute(HandshakeClosure* hs_cl);
  58   static bool execute(HandshakeClosure* hs_cl, JavaThread* target);
  59   static bool execute_direct(HandshakeClosure* hs_cl, JavaThread* target);
  60 };
  61 




  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_RUNTIME_HANDSHAKE_HPP
  26 #define SHARE_RUNTIME_HANDSHAKE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "runtime/flags/flagSetting.hpp"
  31 #include "runtime/semaphore.hpp"
  32 
  33 class JavaThread;
  34 class HandshakeOperation;
  35 
  36 // A handshake closure is a callback that is executed for each JavaThread
  37 // while that thread is in a safepoint safe state. The callback is executed
  38 // either by the thread itself or by the VM thread while keeping the thread
  39 // in a blocked state. A handshake can be performed with a single
  40 // JavaThread as well. In that case the callback is executed either by the
  41 // thread itself or, depending on whether the operation is a direct handshake
  42 // or not, by the JavaThread that requested the handshake or the VMThread
  43 // respectively.
  44 class HandshakeClosure : public ThreadClosure {
  45   const char* const _name;
  46  public:
  47   HandshakeClosure(const char* name) : _name(name) {}
  48   const char* name() const {
  49     return _name;
  50   }
  51   virtual void do_thread(Thread* thread) = 0;
  52 };
  53 
  54 class Handshake : public AllStatic {
  55  public:
  56   // Execution of handshake operation
  57   static void execute(HandshakeClosure* hs_cl);
  58   static bool execute(HandshakeClosure* hs_cl, JavaThread* target);
  59   static bool execute_direct(HandshakeClosure* hs_cl, JavaThread* target);
  60 };
  61 


< prev index next >