2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
exception Exit
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
let termination_thread, exit_wakener = Lwt.wait ()
|
|
|
|
let exit x = Lwt.wakeup exit_wakener x; raise Exit
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
let () =
|
|
|
|
Lwt.async_exception_hook :=
|
|
|
|
(function
|
|
|
|
| Exit -> ()
|
|
|
|
| exn ->
|
|
|
|
Printf.eprintf "Uncaught (asynchronous) exception: %S\n%s\n%!"
|
|
|
|
(Printexc.to_string exn) (Printexc.get_backtrace ());
|
|
|
|
Lwt.wakeup exit_wakener 1)
|