Re: orderlyShutdown question
Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Organization | IT Innovation |
| Message-ID | <[email protected]> |
On Fri, 2010-07-02 at 08:14 -0700, Kevin Reid wrote:
> On Jul 2, 2010, at 2:37, Thomas Leonard wrote:
>
> > I'm having a bit of trouble with shutting down vats. Here's some test
> > code:
> >
> > def makeVat := <unsafe:org.erights.e.elib.vat.makeVat>
> > def seedVat := <elang:interp.seedVatAuthor>(<unsafe>)
> >
> > def test() {
> > def [_, vat] := seedVat("5")
> > println(`created vat $vat`)
> > println(`shutting down vat $vat`)
> > def result := vat<-orderlyShutdown("reason")
> >
> > return when (result) -> {
> > println(`shutdown complete: $result`)
> > test()
> > }
> > }
> >
> > test()
> >
> > interp.blockAtTop()
> >
> >
> > The problem seems to be that once the vat is shut down, it doesn't
> > respond to __whenMoreResolved, so the caller is never notified.
>
> Is that a near or far reference to the vat object?
>
> It's OK to use vat objects from other threads, so try having a near
> reference instead. (And if that helps, then we can discuss the right
> way to have that reference at hand.)
>
> That said, it seems to me that having a reference into a dead vat (in
> general, whether the ref is to a vat object or just some other object
> in that vat) ought to resolve/WMR as a broken reference.
It's near, but using "." instead of "<-" doesn't make any difference
(the result is still a promise). Here's a slightly simpler test-case:
def makeVat := <unsafe:org.erights.e.elib.vat.makeVat>
def seedVat := <elang:interp.seedVatAuthor>(<unsafe>)
def [_, vat] := seedVat("5")
println(`created vat $vat`)
println(`shutting down vat $vat`)
def result := vat.orderlyShutdown("reason")
println(`shutdown result: $result`)
when (result) -> {
println(`shutdown complete: $result`)
}
interp.blockAtTop()
$ rune shutdown.e
created vat <Vat newSeedVat in <runs in newSeedVat>>
shutting down vat <Vat newSeedVat in <runs in newSeedVat>>
shutdown result: <Promise>
[hangs]
--
Dr Thomas Leonard
IT Innovation Centre
2 Venture Road
Southampton
Hampshire SO16 7NP
Tel: +44 0 23 8076 0834
Fax: +44 0 23 8076 0833
mailto:tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]
http://www.it-innovation.soton.ac.uk