Vat
From Erights
(Difference between revisions)
(FgWfXidcc) |
(revert vandalism) |
||
(8 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | + | See [http://www.erights.org/elib/concurrency/vat.html]. | |
+ | |||
+ | |||
+ | ==Example: How to create a new Vat== | ||
+ | <pre> | ||
+ | ? introducer.onTheAir() | ||
+ | # value: ["3DES_SDH_M2", "3DES_SDH_M"] | ||
+ | |||
+ | ? def seedVat := <elang:interp.seedVatAuthor>(<unsafe>).virtualize(introducer) | ||
+ | # value: <virtualSeedVat> | ||
+ | |||
+ | ? def source := "def run(thing) {println(`Thing: $thing`)}" | ||
+ | # value: "def run(thing) {println(`Thing: $thing`)}" | ||
+ | |||
+ | ? def [farObj, vat] := seedVat(source) | ||
+ | # value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>] | ||
+ | |||
+ | ? farObj <- ("Hello Vat") | ||
+ | # value: <Promise> | ||
+ | |||
+ | ? Thing: Hello Vat | ||
+ | |||
+ | # shutting down the vat | ||
+ | ? def ack := vat <- orderlyShutdown("because I said so") | ||
+ | # value: <Promise> | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | [[Category:ELib specification]] |
Latest revision as of 18:58, 20 April 2011
See [1].
Example: How to create a new Vat
? introducer.onTheAir() # value: ["3DES_SDH_M2", "3DES_SDH_M"] ? def seedVat := <elang:interp.seedVatAuthor>(<unsafe>).virtualize(introducer) # value: <virtualSeedVat> ? def source := "def run(thing) {println(`Thing: $thing`)}" # value: "def run(thing) {println(`Thing: $thing`)}" ? def [farObj, vat] := seedVat(source) # value: [<Promise>, <Vat newVirtualSeedVat in <runs in newVirtualSeedVat>>] ? farObj <- ("Hello Vat") # value: <Promise> ? Thing: Hello Vat # shutting down the vat ? def ack := vat <- orderlyShutdown("because I said so") # value: <Promise>