Opentelemetry_util.AswitchSourceAswitch for level-triggered cancellation and cleanup, atomically.
A switch can be flipped to false once, and remains off forever afterwards.
Inspired from https://ocsigen.org/lwt/5.5.0/api/Lwt_switch but thread-safe.
Can be used to turn the switch off
on_turn_off sw f will call f() when sw is turned off. If sw is already off then f() is called immediately.
NOTE f really should not fail, and should be as fast and light as possible.
link parent trigger turns off trigger when parent is turned off