public class VMMutex extends Object implements AutoCloseable
Lock
.
It is not possible to allocate new VM mutexes at run time. All VM mutexes must be allocated
during image generation. They are initialized during startup of the VM, i.e., every VM mutex
consumes resources and contributes to VM startup time.
This class is almost an abstract base class for VMMutex. Sub-classes replace instances of VMMutex
with platform-specific implementations.Constructor and Description |
---|
VMMutex() |
Modifier and Type | Method and Description |
---|---|
void |
assertIsNotLocked(String message)
This method is potentially racy and must only be called in places where we can guarantee that
no incorrect
AssertionError s are thrown because of potential races. |
void |
assertIsOwner(String message) |
void |
assertNotOwner(String message) |
void |
clearCurrentThreadOwner() |
void |
clearUnspecifiedOwner() |
void |
close()
Releases the lock when locking using a try-with-resource statement.
|
void |
guaranteeIsOwner(String message) |
void |
guaranteeNotOwner(String message) |
boolean |
isOwner() |
VMMutex |
lock()
Acquires the lock, with thread status transitions, blocking until the lock is available.
|
void |
lockNoTransition()
Like VMMutex.lock(), but without a thread status transitions.
|
void |
lockNoTransitionUnspecifiedOwner()
Like VMMutex.lockNoTransition(), but the lock owner is set to an unspecified isolate
thread.
|
void |
setOwnerToCurrentThread() |
void |
setOwnerToUnspecified() |
void |
unlock()
Releases the lock.
|
void |
unlockNoTransitionUnspecifiedOwner()
Like VMMutex.unlock().
|
void |
unlockWithoutChecks()
Releases the lock, without checking the result.
|
public VMMutex lock()
public void lockNoTransition()
public void lockNoTransitionUnspecifiedOwner()
public void unlock()
public void unlockNoTransitionUnspecifiedOwner()
public void unlockWithoutChecks()
public final void close()
This is not annotated with Uninterruptible
because using try-with-resources
implicitly calls Throwable.addSuppressed(Throwable)
, which I can not annotate.
close
in interface AutoCloseable
public final void assertIsOwner(String message)
public final void assertNotOwner(String message)
public final void assertIsNotLocked(String message)
AssertionError
s are thrown because of potential races.public final void guaranteeIsOwner(String message)
public final void guaranteeNotOwner(String message)
public final boolean isOwner()
public void setOwnerToCurrentThread()
public void setOwnerToUnspecified()
public void clearCurrentThreadOwner()
public void clearUnspecifiedOwner()