File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -797,16 +797,6 @@ external conndefaults : unit -> conninfo_option array = "PQconndefaults_stub"
797
797
798
798
exception Finally of exn * exn
799
799
800
- let protectx ~f ~(finally : unit -> unit ) =
801
- let res =
802
- try f ()
803
- with exn ->
804
- (try finally () with final_exn -> raise (Finally (exn , final_exn)));
805
- raise exn
806
- in
807
- finally () ;
808
- res
809
-
810
800
module type Mutex = sig
811
801
type t
812
802
@@ -973,13 +963,13 @@ module Connection (Mutex : Mutex) = struct
973
963
failwith " Postgresql.check_null: connection already finished"
974
964
in
975
965
let wrap_conn f =
976
- protectx
977
- ~f: (fun _ ->
966
+ Fun. protect
967
+ ~finally: (fun _ -> Mutex. unlock conn_mtx)
968
+ (fun _ ->
978
969
Mutex. lock conn_mtx;
979
970
check_null () ;
980
971
(* Check again in case the world has changed *)
981
972
f my_conn)
982
- ~finally: (fun _ -> Mutex. unlock conn_mtx)
983
973
in
984
974
let signal_error conn =
985
975
raise (Error (Connection_failure (Stub. error_message conn)))
You can’t perform that action at this time.
0 commit comments