[m-rev.] for review: thread safe mutables (part 2)
Peter Wang
wangp at students.csse.unimelb.edu.au
Wed Sep 13 15:48:26 AEST 2006
On 2006-08-29, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>
> Estimated hours taken: 12
> Branches: main
>
> Make the get and set operations for non-constant mutables thread safe. (The
> get operation for constant mutables is thread safe by definition.) The
> source-to-source transformation for (non-constant) mutables is modified as
> follows: we introduce four primitive operations: unsafe_get, unsafe_set,
> lock and unlock.
I think there's a problem with this. This code no longer compiles:
:- mutable(localsupp, random.supply, random_init(0), mostly_unique,
[attach_to_io_state, untrailed]).
(the important part is the mostly_unique inst)
rand.m:022: In clause for `set_localsupp(in(mostly_unique))':
rand.m:022: in argument 1 of call to predicate `rand.unsafe_set_localsupp'/1:
rand.m:022: unique-mode error: the called procedure would clobber its
rand.m:022: argument, but variable `X' is still live.
rand.m:022: The goal could not be reordered, because it was impure.
rand.m:022: In clause for `set_localsupp(in(mostly_unique), di, uo)':
rand.m:022: in argument 1 of call to predicate `rand.unsafe_set_localsupp'/1:
rand.m:022: unique-mode error: the called procedure would clobber its
rand.m:022: argument, but variable `X' is still live.
rand.m:022: The goal could not be reordered, because it was impure.
Also, I'm not sure what backtrackable update of [non-thread-local]
mutables is supposed to mean in the presence of multiple threads.
Probably nothing sane.
Peter
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list