object Mutex extends Companion[Mutex]
- Source
- Mutex.scala
- Alphabetic
- By Inheritance
- Mutex
- Companion
- OperationCollection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- implicit object converter extends Converter[A]
The MLValue.Converter for
A
.The MLValue.Converter for
A
. Import this as an implicit to support using objects of typeA
in MLFunctions etc.- Definition Classes
- Companion
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def Ops(implicit isabelle: Isabelle, ec: ExecutionContext): Ops
Returns an instance of type Ops.
Returns an instance of type Ops. It is guaranteed that for each instance
isabelle
, exactly one instance ofObs
is created (using theec
from the first such invocation). (If you see this doc string in a class different from OperationCollection but no definition of the class Ops, treat this function as if it was private.)- Definition Classes
- OperationCollection
- def apply()(implicit isabelle: Isabelle, ec: ExecutionContext): Mutex
Creates a new mutex
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def exceptionName(implicit isabelle: Isabelle, ec: ExecutionContext): String
Returns the name of the exception for storing values in the object store.
Returns the name of the exception for storing values in the object store. That is, if
exceptionName
returnsEXN
, then an ML valuea
of type mlType is stored in the object store asEXN a
. If predefinedException is overwritten, this returns predefinedException. Otherwise it returns a fresh exception name (and ensures that that exception is declared).- Definition Classes
- Companion
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def init()(implicit isabelle: Isabelle, executionContext: ExecutionContext): Unit
Makes sure an Ops instance for the instance
isabelle
is initialized.Makes sure an Ops instance for the instance
isabelle
is initialized. This is useful when code needs to be sure that the global initialization inside the Ops class has happened (e.g., declarations of ML types via Isabelle.executeMLCodeNow) even if it does not access any of the fields in the Ops class.Can safely be called several times with the same
isabelle
and/orexecutionContext
.- Definition Classes
- OperationCollection
- def instantiate(mlValue: MLValue[Mutex]): Mutex
Must return a new instance of
A
withA.
mlValue =mlValue
. - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val mlType: String
Must return the ML type corresponding to
A
. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newOps(implicit isabelle: Isabelle, ec: ExecutionContext): Ops
Must return a fresh instance of Ops (with implicit arguments
isabelle
andec
.Must return a fresh instance of Ops (with implicit arguments
isabelle
andec
.- Attributes
- protected
- Definition Classes
- Mutex → Companion → OperationCollection
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val predefinedException: String
Must return the name of the exception for storing ML values of type mlType in the object store in the Isabelle process.
Must return the name of the exception for storing ML values of type mlType in the object store in the Isabelle process. If not overwritten, the exception will be generated automatically. If overwritten, the overriding class needs to ensure that the exception is actually declared in the ML toplevel.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def wrapWithMutex(mutex: String, code: String): String
Returns a fragment of ML code that exectutes the ML code
code
with the mutexmutex
.Returns a fragment of ML code that exectutes the ML code
code
with the mutexmutex
.mutex
is assumed to be the name of an ML value that holds the mutex.Example:
val thyMutex = Mutex() val useThyWithMutex = MLValue.compileFunction[Mutex, String, Unit]( s"fn (mutex,theoryName) => ${Mutex.wrapWithMutex("mutex", "Thy_Info.use_thy name")}")
Then
useThyWithMutex(mutex, "Test.Test")
loads the theoryTest.Test
in Isabelle but makes sure only a single instance is running concurrently (with the locking happening in Isabelle usingmutex
), sinceThy_Info.use_thy
is not thread safe. (In practice, better use Theory.mutex as the mutex instead of your own in this specific case.)