Lwt, system threads, FUSE and ocamlfuse

You could use Lwt_preemptive.detach — just make sure to use one call for the whole lock-signal-unlock sequence, not multiple, and interact with the rest of Lwt by calling Lwt_preemptive.run_in_main in between. This “should” convert blocking on a mutex into blocking on the internal pipe that is inside Lwt_main.run. It does seem a little inconvenient to need a third thread for the two threads to interact. I am not sure if there is some better way to make Lwt and ocamlfuse interact, but I would try to find one.

As for best practices, I think these situations are rare enough to be unique, so it’s not clear what the best practices are.