Enter program from different threads

Part of my program does changes to the UI and that needs to be done on the main thread, but I want to do the rest on a background thread. Is it safe to enter an OCaml program from C using two different threads provided I’m careful not to enter it from thread A while it’s executing on thread B?

1 Like

AFAIK it should be as long as you follow the caml_{release,acquire}_runtime_system dance.

You need to make sure however that the threads are known to the runtime system using caml_c_thread_register().

See the manual for more details.