ensure globally unique counter results;
authorwenzelm
Sat, 09 Apr 2016 11:35:01 +0200
changeset 62920 a5853334c179
parent 62919 9eb0359d6a77
child 62921 499a63c30d55
ensure globally unique counter results;
src/Pure/Concurrent/counter.ML
--- a/src/Pure/Concurrent/counter.ML	Sat Apr 09 11:34:23 2016 +0200
+++ b/src/Pure/Concurrent/counter.ML	Sat Apr 09 11:35:01 2016 +0200
@@ -16,13 +16,12 @@
 
 fun make () =
   let
-    val counter = Synchronized.var "counter" (0: int);
+    val counter = Synchronized.var "counter" 0;
     fun next () =
       Synchronized.change_result counter
         (fn i =>
-          let val j = i + (1: int)
+          let val j = i + (if Thread_Data.is_virtual then 3 else 2)
           in (j, j) end);
   in next end;
 
 end;
-