Module Low_level_debug

module Low_level_debug: sig .. end
A canary thread starts two threads, one in caml and one in C. The caml thread tries to take the caml lock every check_interval, and immediately releases it once it succeeds. The C thread checks that your thread is getting the caml lock within max_wait, and if it isn't it stops the program (see stop_me_now). You can then inspect your program with gdb and hopefully determine what caused it to block. It is safe to continue a program stopped by the canary thread, though there is no special handling in the canary thread to support this, so it may stop your program again. If you do manage to continue, the canary thread should continue to work.

It is not safe to call this function more than once, in a given program an exception will be raised if you do (but a second canary will not be started).


val stop_upon_sigbus : unit -> unit
val stop_upon_sigsegv : unit -> unit
val stop_upon_sigpipe : unit -> unit
val stop_upon_exit : unit -> unit
val stop_me_now : unit -> unit
val segfault_me_now : unit -> unit
val start_canary_thread : max_wait:Core.Std.Time.Span.t -> check_interval:Core.Std.Time.Span.t -> unit
A canary thread starts two threads, one in caml and one in C. The caml thread tries to take the caml lock every check_interval, and immediately releases it once it succeeds. The C thread checks that your thread is getting the caml lock within max_wait, and if it isn't it stops the program (see stop_me_now). You can then inspect your program with gdb and hopefully determine what caused it to block. It is safe to continue a program stopped by the canary thread, though there is no special handling in the canary thread to support this, so it may stop your program again. If you do manage to continue, the canary thread should continue to work.

It is not safe to call this function more than once, in a given program an exception will be raised if you do (but a second canary will not be started).