37 // either by the thread itself or by the VM thread while keeping the thread
38 // in a blocked state. A handshake can be performed with a single
39 // JavaThread as well.
40 class Handshake : public AllStatic {
41 public:
42 // Execution of handshake operation
43 static void execute(ThreadClosure* thread_cl);
44 static bool execute(ThreadClosure* thread_cl, JavaThread* target);
45 };
46
47 class HandshakeOperation;
48
49 // The HandshakeState keep tracks of an ongoing handshake for one JavaThread.
50 // VM thread and JavaThread are serialized with the semaphore making sure
51 // the operation is only done by either VM thread on behalf of the JavaThread
52 // or the JavaThread itself.
53 class HandshakeState {
54 HandshakeOperation* volatile _operation;
55
56 Semaphore _semaphore;
57 bool _vmthread_holds_semaphore;
58 bool _thread_in_process_handshake;
59
60 bool claim_handshake_for_vmthread();
61 bool vmthread_can_process_handshake(JavaThread* target);
62
63 void clear_handshake(JavaThread* thread);
64 void cancel_inner(JavaThread* thread);
65
66 void process_self_inner(JavaThread* thread);
67 public:
68 HandshakeState();
69
70 void set_operation(JavaThread* thread, HandshakeOperation* op);
71
72 bool has_operation() const {
73 return _operation != NULL;
74 }
75
76 void cancel(JavaThread* thread) {
77 if (!_thread_in_process_handshake) {
|
37 // either by the thread itself or by the VM thread while keeping the thread
38 // in a blocked state. A handshake can be performed with a single
39 // JavaThread as well.
40 class Handshake : public AllStatic {
41 public:
42 // Execution of handshake operation
43 static void execute(ThreadClosure* thread_cl);
44 static bool execute(ThreadClosure* thread_cl, JavaThread* target);
45 };
46
47 class HandshakeOperation;
48
49 // The HandshakeState keep tracks of an ongoing handshake for one JavaThread.
50 // VM thread and JavaThread are serialized with the semaphore making sure
51 // the operation is only done by either VM thread on behalf of the JavaThread
52 // or the JavaThread itself.
53 class HandshakeState {
54 HandshakeOperation* volatile _operation;
55
56 Semaphore _semaphore;
57 bool _thread_in_process_handshake;
58
59 bool claim_handshake_for_vmthread();
60 bool vmthread_can_process_handshake(JavaThread* target);
61
62 void clear_handshake(JavaThread* thread);
63 void cancel_inner(JavaThread* thread);
64
65 void process_self_inner(JavaThread* thread);
66 public:
67 HandshakeState();
68
69 void set_operation(JavaThread* thread, HandshakeOperation* op);
70
71 bool has_operation() const {
72 return _operation != NULL;
73 }
74
75 void cancel(JavaThread* thread) {
76 if (!_thread_in_process_handshake) {
|