Client/Context_unix: code style
This commit is contained in:
parent
24355f0ae9
commit
e35e263fd6
@ -37,8 +37,7 @@ class unix_wallet ~base_dir : wallet = object (self)
|
||||
let unlock fd =
|
||||
let fd = Lwt_unix.unix_file_descr fd in
|
||||
Unix.lockf fd Unix.F_ULOCK 0 ;
|
||||
Unix.close fd
|
||||
in
|
||||
Unix.close fd in
|
||||
let lock () =
|
||||
Lwt_unix.openfile (Filename.concat base_dir "wallet_lock")
|
||||
Lwt_unix.[ O_CREAT ; O_WRONLY ] 0o644 >>= fun fd ->
|
||||
@ -46,8 +45,7 @@ class unix_wallet ~base_dir : wallet = object (self)
|
||||
Lwt.return (fd, (Lwt_unix.on_signal Sys.sigint
|
||||
(fun _s ->
|
||||
unlock fd ;
|
||||
exit 0 (* exit code? *) )))
|
||||
in
|
||||
exit 0 (* exit code? *) ))) in
|
||||
lock () >>= fun (fd, sh) ->
|
||||
(* catch might be useless if f always uses the error monad *)
|
||||
Lwt.catch f (function e -> Lwt.return (unlock fd ; raise e)) >>= fun res ->
|
||||
|
Loading…
Reference in New Issue
Block a user