Dummy version of state variables -- plain refs for sequential access.
authorwenzelm
Mon Sep 28 23:51:13 2009 +0200 (2009-09-28)
changeset 32736f126e68d003d
parent 32735 f96f3ae3a19d
child 32737 76fa673eee8b
child 32759 1476fe841023
child 32772 50d090ca93f8
Dummy version of state variables -- plain refs for sequential access.
src/Pure/Concurrent/synchronized_dummy.ML
src/Pure/IsaMakefile
src/Pure/ML-Systems/thread_dummy.ML
src/Pure/ROOT.ML
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/Pure/Concurrent/synchronized_dummy.ML	Mon Sep 28 23:51:13 2009 +0200
     1.3 @@ -0,0 +1,25 @@
     1.4 +(*  Title:      Pure/Concurrent/synchronized_dummy.ML
     1.5 +    Author:     Makarius
     1.6 +
     1.7 +Dummy version of state variables -- plain refs for sequential access.
     1.8 +*)
     1.9 +
    1.10 +structure Synchronized: SYNCHRONIZED =
    1.11 +struct
    1.12 +
    1.13 +datatype 'a var = Var of 'a ref;
    1.14 +
    1.15 +fun var _ x = Var (ref x);
    1.16 +fun value (Var var) = ! var;
    1.17 +
    1.18 +fun timed_access (Var var) _ f =
    1.19 +  (case f (! var) of
    1.20 +    SOME (y, x') => (var := x'; SOME y)
    1.21 +  | NONE => Thread.unavailable ());
    1.22 +
    1.23 +fun guarded_access var f = the (timed_access var (K NONE) f);
    1.24 +
    1.25 +fun change_result var f = guarded_access var (SOME o f);
    1.26 +fun change var f = change_result var (fn x => ((), f x));
    1.27 +
    1.28 +end;
     2.1 --- a/src/Pure/IsaMakefile	Mon Sep 28 23:19:50 2009 +0200
     2.2 +++ b/src/Pure/IsaMakefile	Mon Sep 28 23:51:13 2009 +0200
     2.3 @@ -45,32 +45,33 @@
     2.4  $(OUT)/Pure: $(BOOTSTRAP_FILES) Concurrent/future.ML			\
     2.5    Concurrent/mailbox.ML Concurrent/par_list.ML				\
     2.6    Concurrent/par_list_dummy.ML Concurrent/simple_thread.ML		\
     2.7 -  Concurrent/synchronized.ML Concurrent/task_queue.ML General/alist.ML	\
     2.8 -  General/antiquote.ML General/balanced_tree.ML General/basics.ML	\
     2.9 -  General/binding.ML General/buffer.ML General/file.ML			\
    2.10 -  General/graph.ML General/heap.ML General/integer.ML General/lazy.ML	\
    2.11 -  General/long_name.ML General/markup.ML General/name_space.ML		\
    2.12 -  General/ord_list.ML General/output.ML General/path.ML			\
    2.13 -  General/position.ML General/pretty.ML General/print_mode.ML		\
    2.14 -  General/properties.ML General/queue.ML General/same.ML		\
    2.15 -  General/scan.ML General/secure.ML General/seq.ML General/source.ML	\
    2.16 -  General/stack.ML General/symbol.ML General/symbol_pos.ML		\
    2.17 -  General/table.ML General/url.ML General/xml.ML General/yxml.ML	\
    2.18 -  Isar/args.ML Isar/attrib.ML Isar/auto_bind.ML Isar/calculation.ML	\
    2.19 -  Isar/class.ML Isar/class_target.ML Isar/code.ML Isar/constdefs.ML	\
    2.20 -  Isar/context_rules.ML Isar/element.ML Isar/expression.ML		\
    2.21 -  Isar/isar_cmd.ML Isar/isar_document.ML Isar/isar_syn.ML		\
    2.22 -  Isar/local_defs.ML Isar/local_syntax.ML Isar/local_theory.ML		\
    2.23 -  Isar/locale.ML Isar/method.ML Isar/object_logic.ML Isar/obtain.ML	\
    2.24 -  Isar/outer_keyword.ML Isar/outer_lex.ML Isar/outer_parse.ML		\
    2.25 -  Isar/outer_syntax.ML Isar/overloading.ML Isar/proof.ML		\
    2.26 -  Isar/proof_context.ML Isar/proof_display.ML Isar/proof_node.ML	\
    2.27 -  Isar/rule_cases.ML Isar/rule_insts.ML Isar/runtime.ML			\
    2.28 -  Isar/skip_proof.ML Isar/spec_parse.ML Isar/specification.ML		\
    2.29 -  Isar/theory_target.ML Isar/toplevel.ML Isar/value_parse.ML		\
    2.30 -  ML/ml_antiquote.ML ML/ml_compiler.ML ML/ml_compiler_polyml-5.3.ML	\
    2.31 -  ML/ml_context.ML ML/ml_env.ML ML/ml_lex.ML ML/ml_parse.ML		\
    2.32 -  ML/ml_syntax.ML ML/ml_thms.ML ML-Systems/install_pp_polyml.ML		\
    2.33 +  Concurrent/synchronized.ML Concurrent/synchronized_dummy.ML		\
    2.34 +  Concurrent/task_queue.ML General/alist.ML General/antiquote.ML	\
    2.35 +  General/balanced_tree.ML General/basics.ML General/binding.ML		\
    2.36 +  General/buffer.ML General/file.ML General/graph.ML General/heap.ML	\
    2.37 +  General/integer.ML General/lazy.ML General/long_name.ML		\
    2.38 +  General/markup.ML General/name_space.ML General/ord_list.ML		\
    2.39 +  General/output.ML General/path.ML General/position.ML			\
    2.40 +  General/pretty.ML General/print_mode.ML General/properties.ML		\
    2.41 +  General/queue.ML General/same.ML General/scan.ML General/secure.ML	\
    2.42 +  General/seq.ML General/source.ML General/stack.ML General/symbol.ML	\
    2.43 +  General/symbol_pos.ML General/table.ML General/url.ML General/xml.ML	\
    2.44 +  General/yxml.ML Isar/args.ML Isar/attrib.ML Isar/auto_bind.ML		\
    2.45 +  Isar/calculation.ML Isar/class.ML Isar/class_target.ML Isar/code.ML	\
    2.46 +  Isar/constdefs.ML Isar/context_rules.ML Isar/element.ML		\
    2.47 +  Isar/expression.ML Isar/isar_cmd.ML Isar/isar_document.ML		\
    2.48 +  Isar/isar_syn.ML Isar/local_defs.ML Isar/local_syntax.ML		\
    2.49 +  Isar/local_theory.ML Isar/locale.ML Isar/method.ML			\
    2.50 +  Isar/object_logic.ML Isar/obtain.ML Isar/outer_keyword.ML		\
    2.51 +  Isar/outer_lex.ML Isar/outer_parse.ML Isar/outer_syntax.ML		\
    2.52 +  Isar/overloading.ML Isar/proof.ML Isar/proof_context.ML		\
    2.53 +  Isar/proof_display.ML Isar/proof_node.ML Isar/rule_cases.ML		\
    2.54 +  Isar/rule_insts.ML Isar/runtime.ML Isar/skip_proof.ML			\
    2.55 +  Isar/spec_parse.ML Isar/specification.ML Isar/theory_target.ML	\
    2.56 +  Isar/toplevel.ML Isar/value_parse.ML ML/ml_antiquote.ML		\
    2.57 +  ML/ml_compiler.ML ML/ml_compiler_polyml-5.3.ML ML/ml_context.ML	\
    2.58 +  ML/ml_env.ML ML/ml_lex.ML ML/ml_parse.ML ML/ml_syntax.ML		\
    2.59 +  ML/ml_thms.ML ML-Systems/install_pp_polyml.ML				\
    2.60    ML-Systems/install_pp_polyml-5.3.ML ML-Systems/use_context.ML		\
    2.61    Proof/extraction.ML Proof/proof_rewrite_rules.ML			\
    2.62    Proof/proof_syntax.ML Proof/proofchecker.ML Proof/reconstruct.ML	\
     3.1 --- a/src/Pure/ML-Systems/thread_dummy.ML	Mon Sep 28 23:19:50 2009 +0200
     3.2 +++ b/src/Pure/ML-Systems/thread_dummy.ML	Mon Sep 28 23:51:13 2009 +0200
     3.3 @@ -35,6 +35,8 @@
     3.4    datatype threadAttribute = EnableBroadcastInterrupt of bool | InterruptState of interruptState
     3.5      and interruptState = InterruptDefer | InterruptSynch | InterruptAsynch | InterruptAsynchOnce;
     3.6  
     3.7 +  fun unavailable () = fail ();
     3.8 +
     3.9    fun fork _ = fail ();
    3.10    fun exit _ = fail ();
    3.11    fun isActive _ = fail ();
     4.1 --- a/src/Pure/ROOT.ML	Mon Sep 28 23:19:50 2009 +0200
     4.2 +++ b/src/Pure/ROOT.ML	Mon Sep 28 23:51:13 2009 +0200
     4.3 @@ -58,6 +58,7 @@
     4.4  
     4.5  use "Concurrent/simple_thread.ML";
     4.6  use "Concurrent/synchronized.ML";
     4.7 +if Multithreading.available then () else use "Concurrent/synchronized_dummy.ML";
     4.8  use "Concurrent/mailbox.ML";
     4.9  use "Concurrent/task_queue.ML";
    4.10  use "Concurrent/future.ML";