Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Some JavaThread handshake operations must be performed by only the targeted thread(s). The most common situation is that a JavaThread should wait for something. If the targeted JavaThread is safepoint-safe (e.g., blocked/native) it can't start waiting and the VMThread can't wait for it. The JavaThread may be indefinitely safepoint-safe so the handshake operation may never be executed. The requesting thread cannot use a synchronous handshake since it might never finish. By letting the request be asynchronous and guarantee that the handshake operation will be performed if the thread tries to leave the safepoint-safe state, the requester can act as if the JavaThread was already waiting in that handshake operation. Right now a JavaThread can only have one handshake operation so an asynchronous handshake would thus block all other handshakes. This means that it's not enough to make the request asynchronous, but also a queue is needed to be able to process concurrent handshake operations.
|