summaryrefslogtreecommitdiff
path: root/library/states.ml
diff options
context:
space:
mode:
authorGravatar Stephane Glondu <steph@glondu.net>2009-07-04 13:28:35 +0200
committerGravatar Stephane Glondu <steph@glondu.net>2009-07-04 13:28:35 +0200
commite4282ea99c664d8d58067bee199cbbcf881b60d5 (patch)
treed4c4a873eb055c728666f367469fa26c3417793a /library/states.ml
parenta0a94c1340a63cdb824507b973393882666ba52a (diff)
Imported Upstream version 8.2.pl1+dfsgupstream/8.2.pl1+dfsg
Diffstat (limited to 'library/states.ml')
-rw-r--r--library/states.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/library/states.ml b/library/states.ml
index 7f7fef47..c81f9614 100644
--- a/library/states.ml
+++ b/library/states.ml
@@ -6,7 +6,7 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(* $Id: states.ml 11313 2008-08-07 11:15:03Z barras $ *)
+(* $Id: states.ml 12080 2009-04-11 16:56:20Z herbelin $ *)
open System
@@ -35,3 +35,10 @@ let with_heavy_rollback f x =
f x
with reraise ->
(unfreeze st; raise reraise)
+
+let with_state_protection f x =
+ let st = freeze () in
+ try
+ let a = f x in unfreeze st; a
+ with reraise ->
+ (unfreeze st; raise reraise)