public static class RVMThread.SuspendBlockAdapter extends RVMThread.BlockAdapter
Constructor and Description |
---|
SuspendBlockAdapter() |
Modifier and Type | Method and Description |
---|---|
(package private) void |
clearBlockRequest(RVMThread t)
Clears any blocking requests for the thread.
|
(package private) boolean |
hasBlockRequest(RVMThread t) |
(package private) boolean |
hasBlockRequest(RVMThread t,
int token) |
(package private) boolean |
isBlocked(RVMThread t) |
(package private) int |
requestBlock(RVMThread t)
Requests that the thread block, for this block adapter, at its earliest
convenience.
|
(package private) void |
setBlocked(RVMThread t,
boolean value)
Specifies that the thread is either blocked
(value == true) or not
blocked (value == false) for this block adapter. |
public SuspendBlockAdapter()
boolean isBlocked(RVMThread t)
isBlocked
in class RVMThread.BlockAdapter
t
- a threadtrue
, the thread is guaranteed to block.void setBlocked(RVMThread t, boolean value)
RVMThread.BlockAdapter
(value == true)
or not
blocked (value == false)
for this block adapter. This call
indicates a statement of fact by the thread itself - it's used either
to acknowledge a block request (see RVMThread.BlockAdapter.hasBlockRequest(RVMThread)
below) or to respond to a request to unblock.setBlocked
in class RVMThread.BlockAdapter
t
- the threadvalue
- the new value of the status for blocking as described aboveint requestBlock(RVMThread t)
RVMThread.BlockAdapter
Called from RVMThread.block() and associated methods. Some block adapters allow for multiple requests to block; in that case this will return a "token" that can be passed to hasBlockRequest() to check, not only whether there is a block request, but whether that block request is still associated with a particular call to requestBlock(). This is used to prevent a suspend() call from stalling due to a concurrent resume() and second suspend(). Note that most block adapers don't care about this scenario, and will just return 0 (or some other meaningless number) here.
requestBlock
in class RVMThread.BlockAdapter
t
- the thread that needs to blockboolean hasBlockRequest(RVMThread t)
hasBlockRequest
in class RVMThread.BlockAdapter
t
- the threadboolean hasBlockRequest(RVMThread t, int token)
hasBlockRequest
in class RVMThread.BlockAdapter
t
- the thread to check for block requeststoken
- a token, see RVMThread.BlockAdapter.requestBlock(RVMThread)
void clearBlockRequest(RVMThread t)
RVMThread.BlockAdapter
clearBlockRequest
in class RVMThread.BlockAdapter
t
- thread whose block requests will be cleared