Determining if the runtime system is currently acquired from C

Is it possible to determine if the runtime lock is currently acquired from C? I currently have some code which is sometimes called with the lock acquired and sometimes not. If the lock is already acquired, calling caml_acquire_runtime_system again will cause a deadlock. I was curious if there was something akin to pthread_mutex_trylock (although slightly different, obviously) to determine if the current thread is holding the runtime lock already so I can avoid problems like this.


1 Like