future_job: propagate current Position.thread_data to the forked job -- this is important to provide a default position, e.g. for parallelizied Goal.prove within a package (proper command transactions are wrapped via Toplevel.setmp_thread_position);
authorwenzelm
Fri, 21 May 2010 21:28:31 +0200
changeset 37046 78d88b670a53
parent 37045 83ea8b551280
child 37047 4a95a50d0ec4
future_job: propagate current Position.thread_data to the forked job -- this is important to provide a default position, e.g. for parallelizied Goal.prove within a package (proper command transactions are wrapped via Toplevel.setmp_thread_position);
src/Pure/Concurrent/future.ML
--- a/src/Pure/Concurrent/future.ML	Fri May 21 20:46:00 2010 +0200
+++ b/src/Pure/Concurrent/future.ML	Fri May 21 21:28:31 2010 +0200
@@ -170,12 +170,14 @@
 fun future_job group (e: unit -> 'a) =
   let
     val result = Single_Assignment.var "future" : 'a result;
+    val pos = Position.thread_data ();
     fun job ok =
       let
         val res =
           if ok then
             Exn.capture (fn () =>
-              Multithreading.with_attributes Multithreading.private_interrupts (fn _ => e ())) ()
+              Multithreading.with_attributes Multithreading.private_interrupts
+                (fn _ => Position.setmp_thread_data pos e ())) ()
           else Exn.Exn Exn.Interrupt;
       in assign_result group result res end;
   in (result, job) end;