62929
|
1 |
(* Title: Pure/Concurrent/thread_position.ML
|
|
2 |
Author: Makarius
|
|
3 |
|
|
4 |
Thread-local position information.
|
|
5 |
*)
|
|
6 |
|
|
7 |
signature THREAD_POSITION =
|
|
8 |
sig
|
|
9 |
val get: unit -> (string * string) list
|
|
10 |
val setmp: (string * string) list -> ('a -> 'b) -> 'a -> 'b
|
|
11 |
end;
|
|
12 |
|
|
13 |
structure Thread_Position: THREAD_POSITION =
|
|
14 |
struct
|
|
15 |
|
|
16 |
val var = Thread_Data.var () : (string * string) list Thread_Data.var;
|
|
17 |
|
|
18 |
fun get () =
|
|
19 |
(case Thread_Data.get var of
|
|
20 |
NONE => []
|
|
21 |
| SOME props => props);
|
|
22 |
|
|
23 |
fun setmp props f x =
|
|
24 |
Thread_Data.setmp var (if List.null props then NONE else SOME props) f x;
|
|
25 |
|
|
26 |
end;
|