Source

openCore.Stdletdebug=is_some(Sys.getenv"DEBUG_ASYNC")(** When [RECORD_ASYNC_BACKTRACES] is set, the Async scheduler records a backtrace everytime it schedules a job, and will include the backtrace history in any exceptions raised to monitors, and in particular, in an unhandled exception that reaches the main monitor. *)letrecord_backtraces=matchBacktrace.getwith|Ok_->is_some(Sys.getenv"RECORD_ASYNC_BACKTRACES")|Error_->(* unimplemented *)false(* Calls to [Debug.log] should look like [if Debug.debug then Debug.log ...]. *)letlogmessageasexp_of_a=eprintf"%s\n%!"(Sexp.to_string_mach(<:sexp_of<Pid.t*int*Time.t*string*a>>(Unix.getpid(),Thread.id(Thread.self()),Time.now(),message,a)));;let()=ifdebugthenlog"record_backtraces"record_backtraces<:sexp_of<bool>>letlog_stringmessage=logmessage()<:sexp_of<unit>>