src/Pure/Concurrent/thread_position.ML
changeset 62929 b92565f98206
child 62940 a03592aafadf
equal deleted inserted replaced
62928:0953dec1fcb0 62929:b92565f98206
       
     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;