src/Pure/ML-Systems/unsynchronized.ML
changeset 39616 8052101883c3
parent 38799 712cb964d113
--- a/src/Pure/ML-Systems/unsynchronized.ML	Wed Sep 22 17:46:59 2010 +0200
+++ b/src/Pure/ML-Systems/unsynchronized.ML	Wed Sep 22 18:21:48 2010 +0200
@@ -18,4 +18,13 @@
 fun inc i = (i := ! i + (1: int); ! i);
 fun dec i = (i := ! i - (1: int); ! i);
 
+fun setmp flag value f x =
+  uninterruptible (fn restore_attributes => fn () =>
+    let
+      val orig_value = ! flag;
+      val _ = flag := value;
+      val result = Exn.capture (restore_attributes f) x;
+      val _ = flag := orig_value;
+    in Exn.release result end) ();
+
 end;