Files
mercury/tests/hard_coded/sub-modules/mutable_parent.m
Julien Fischer fe65fe427e Get rid of the `thread_safe' mutable attribute, since this doesn't actually
Estimated hours taken: 1
Branches: main, release

Get rid of the `thread_safe' mutable attribute, since this doesn't actually
make access to a mutable thread safe (in fact it makes them less thread
safe than the `not_thread_safe' version).

By extension this also removes support for the `not_thread_safe' mutable
attribute.

compiler/prog_io.m:
compiler/prog_item.m:
compiler/prog_mutable.m:
	Remove support for the `thread_safe' mutable attribute.

compiler/make_hlds_passes.m:
	Remove support for the `thread_safe' mutable attribute.

	Mark the foreign clauses for `get' predicates for constant
	mutables as thread safe.

doc/reference_manual.texi:
	Delete the documentation for the `thread_safe' mutable attribute.

tests/hard_coded/mutable_decl.m:
tests/hard_coded/pure_mutable.m:
tests/hard_coded/trace_goal_env_1.m:
tests/hard_coded/trace_goal_env_2.m:
tests/hard_coded/unusual_name_mutable.m:
tests/hard_coded/sub-modules/mutable_child.m:
tests/hard_coded/sub-modules/mutable_grandchild.m:
tests/hard_coded/sub-modules/mutable_parent.m:
tests/invalid/bad_mutable.{err_exp,m}:
tests/invalid/not_in_interface.m:
	Conform to the above change.
2006-08-14 09:09:22 +00:00

38 lines
952 B
Mathematica

:- module mutable_parent.
:- interface.
:- import_module io.
:- include_module mutable_child.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module int.
:- import_module list.
:- import_module string.
:- import_module mutable_parent.mutable_child.
:- import_module mutable_parent.mutable_child.mutable_grandchild.
:- mutable(parent_global, int, 100, ground,
[untrailed, attach_to_io_state]).
main(!IO) :-
mutable_parent.run_parent(!IO),
mutable_parent.mutable_child.run_child(!IO),
mutable_parent.mutable_child.mutable_grandchild.run_grandchild(!IO),
io.write_string("Back in parent ...\n", !IO),
get_parent_global(ParentGlobal, !IO),
io.format(" parent_global = %d\n", [i(ParentGlobal)], !IO).
:- pred run_parent(io::di, io::uo) is det.
run_parent(!IO) :-
io.write_string("In parent ...\n", !IO),
get_parent_global(X, !IO),
io.format(" parent_global = %d\n", [i(X)], !IO),
set_parent_global(X + 1, !IO).