The issue at hand is that Lwt.join
finishes before the reporter had a chance to emit the log message Logs.app
is fire-and-forget, please have a look at the documentation (http://erratique.ch/software/logs/doc/Logs.html#sync).
AFAICT there are two solutions, either use Logs_lwt
:
let log message i =
Logs_lwt.app (fun m -> m "thread %d %s" i message)
(and then add logs.lwt
to your call to ocamlfind
).
Or, add an arbitrary amount of idling before exiting:
let () =
Lwt_main.run(Lwt.join threads >>= fun () -> Lwt_unix.sleep 1.0)