Dear Hongwei,
thank you for your reply.

On Sat, Aug 29, 2020 at 11:05 PM Hongwei Xi <gmh...@gmail.com> wrote:
> In the following code, the proof of the view associated with opts is
> stored in inp.sh. This proof needs to be taken out and put back into view@opts
> before the function main0 can exit.
>
> implement main0 () = let
>     var opts: ip6_pktopts
>     var inp: inpcb
>     val () = inp.in6p_outputopts := addr@opts
>     val () = inp.sh := shared_make(view@opts | addr@opts)
>   in
>     ignoret(usleep(1000u))
>   end

So I think I miss-understanded `ignoret`.
Then I tried to use `shared_unref` to return `view@opts`.
But the code causes the other error:

https://github.com/metasepi/postmortem/commit/cb97cf86f5cdb766b7b6123db674f58b95ed793c

```ats
implement main0 () = let
    var opts: ip6_pktopts
    var inp: inpcb
    val () = inp.in6p_outputopts := addr@opts
    val () = inp.sh := shared_make(view@opts | addr@opts)
    val (pf_oopts | x, count) = shared_unref(inp.sh)
    val () = assertloc(count <= 1)
    prval Some_v(pf_opts) = pf_oopts
    prval () = view@opts := pf_opts
  in
    ignoret(usleep(1000u))
  end
```

```
$ patscc -D_GNU_SOURCE -DATS_MEMALLOC_LIBC main.dats -lpthread
../main.dats: 2867(line=106, offs=16) -- 2887(line=106, offs=36):
error(3): viewat-restoration cannot be performed: mismatch of bef/aft
locations of atviews:
bef: [S2Evar(opts(8626))]
aft: [S2Evar(l$8797$8799(14588))]
```

Are `view@opts` and return from `shared_unref` not the same?

Best regards,
-- 
Kiwamu Okabe at METASEPI DESIGN

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAEvX6d%3DGfoVn7yJveTeiKpmOd0Kz%2Bkn_nCHQf3kfQJ-JkRtprw%40mail.gmail.com.

Reply via email to