equal
deleted
inserted
replaced
5 barrier for further exploration of exec fragments. |
5 barrier for further exploration of exec fragments. |
6 *) |
6 *) |
7 |
7 |
8 signature EXECUTION = |
8 signature EXECUTION = |
9 sig |
9 sig |
|
10 val reset: unit -> unit |
10 val start: unit -> Document_ID.execution |
11 val start: unit -> Document_ID.execution |
11 val discontinue: unit -> unit |
12 val discontinue: unit -> unit |
12 val is_running: Document_ID.execution -> bool |
13 val is_running: Document_ID.execution -> bool |
13 val is_running_exec: Document_ID.exec -> bool |
14 val is_running_exec: Document_ID.exec -> bool |
14 val running: Document_ID.execution -> Document_ID.exec -> bool |
15 val running: Document_ID.execution -> Document_ID.exec -> bool |
17 end; |
18 end; |
18 |
19 |
19 structure Execution: EXECUTION = |
20 structure Execution: EXECUTION = |
20 struct |
21 struct |
21 |
22 |
22 val state = |
23 (* global state *) |
23 Synchronized.var "Execution.state" |
24 |
24 (Document_ID.none, Inttab.empty: Future.group Inttab.table); |
25 type state = Document_ID.execution * Future.group Inttab.table; |
|
26 |
|
27 val init_state: state = (Document_ID.none, Inttab.empty); |
|
28 val state = Synchronized.var "Execution.state" init_state; |
25 |
29 |
26 |
30 |
27 (* unique running execution *) |
31 (* unique running execution *) |
|
32 |
|
33 fun reset () = Synchronized.change state (K init_state); |
28 |
34 |
29 fun start () = |
35 fun start () = |
30 let |
36 let |
31 val execution_id = Document_ID.make (); |
37 val execution_id = Document_ID.make (); |
32 val _ = Synchronized.change state (apfst (K execution_id)); |
38 val _ = Synchronized.change state (apfst (K execution_id)); |