src/Pure/ML-Systems/multithreading_dummy.ML
author wenzelm
Tue, 14 Aug 2007 23:23:06 +0200
changeset 24277 6442fde2daaa
parent 24207 402d629925ed
child 24593 1547ea587f5a
permissions -rw-r--r--
added implicit type mode (cf. Type.mode); added inner syntax parsers for sort/typ (no term/prop yet); infer_types: exception TYPE => error; read_vars: Syntax.parse_typ;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/ML-Systems/multithreading_dummy.ML
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     3
    Author:     Makarius
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     4
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     5
Compatibility file for ML systems without multithreading.
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     6
*)
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     7
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     8
signature MULTITHREADING =
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
     9
sig
24118
464f260e5a20 multithreading trace: int;
wenzelm
parents: 24059
diff changeset
    10
  val trace: int ref
464f260e5a20 multithreading trace: int;
wenzelm
parents: 24059
diff changeset
    11
  val tracing: int -> (unit -> string) -> unit
23980
d35dc9344515 added structure Task;
wenzelm
parents: 23973
diff changeset
    12
  val available: bool
23973
b6ce6de5b700 renamed number_of_threads to max_threads;
wenzelm
parents: 23960
diff changeset
    13
  val max_threads: int ref
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    14
  val self_critical: unit -> bool
23990
72a9b436af56 renamed CRITICAL' to NAMED_CRITICAL;
wenzelm
parents: 23980
diff changeset
    15
  val NAMED_CRITICAL: string -> (unit -> 'a) -> 'a
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    16
  val CRITICAL: (unit -> 'a) -> 'a
24207
402d629925ed schedule: more precise task model;
wenzelm
parents: 24118
diff changeset
    17
  datatype 'a task =
402d629925ed schedule: more precise task model;
wenzelm
parents: 24118
diff changeset
    18
    Task of {body: unit -> unit, cont: 'a -> 'a, fail: 'a -> 'a} | Wait | Terminate;
402d629925ed schedule: more precise task model;
wenzelm
parents: 24118
diff changeset
    19
  val schedule: int -> ('a -> 'a task * 'a) -> 'a -> exn list
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    20
end;
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    21
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    22
structure Multithreading: MULTITHREADING =
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    23
struct
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    24
24118
464f260e5a20 multithreading trace: int;
wenzelm
parents: 24059
diff changeset
    25
val trace = ref 0;
464f260e5a20 multithreading trace: int;
wenzelm
parents: 24059
diff changeset
    26
fun tracing _ _ = ();
23980
d35dc9344515 added structure Task;
wenzelm
parents: 23973
diff changeset
    27
d35dc9344515 added structure Task;
wenzelm
parents: 23973
diff changeset
    28
val available = false;
23973
b6ce6de5b700 renamed number_of_threads to max_threads;
wenzelm
parents: 23960
diff changeset
    29
val max_threads = ref 1;
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    30
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    31
fun self_critical () = false;
23990
72a9b436af56 renamed CRITICAL' to NAMED_CRITICAL;
wenzelm
parents: 23980
diff changeset
    32
fun NAMED_CRITICAL _ e = e ();
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    33
fun CRITICAL e = e ();
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    34
24207
402d629925ed schedule: more precise task model;
wenzelm
parents: 24118
diff changeset
    35
datatype 'a task =
402d629925ed schedule: more precise task model;
wenzelm
parents: 24118
diff changeset
    36
  Task of {body: unit -> unit, cont: 'a -> 'a, fail: 'a -> 'a} | Wait | Terminate;
402d629925ed schedule: more precise task model;
wenzelm
parents: 24118
diff changeset
    37
24059
89a5382406a1 tuned msg;
wenzelm
parents: 23990
diff changeset
    38
fun schedule _ _ _ = raise Fail "No multithreading support";
23973
b6ce6de5b700 renamed number_of_threads to max_threads;
wenzelm
parents: 23960
diff changeset
    39
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    40
end;
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    41
23990
72a9b436af56 renamed CRITICAL' to NAMED_CRITICAL;
wenzelm
parents: 23980
diff changeset
    42
val NAMED_CRITICAL = Multithreading.NAMED_CRITICAL;
23960
c07ae96cbfc4 Compatibility file for ML systems without multithreading.
wenzelm
parents:
diff changeset
    43
val CRITICAL = Multithreading.CRITICAL;