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).
Obtain a sexp representation of any type. Note that this will likely infinite-loop and overflow the stack for any value whose structure is circularly recursive.