fswatch
fswatch copied to clipboard
`on_stop()` is not called on destruction of a monitor
Destruction happens bottom-up, meaning that once the ~monitor
method is executing, the subclass is not existent anymore and the on_stop
method will dispatch to the no-op one.
This is a blocking issue for who is using the C binding as destroying a monitor is the only way to stop it.
I suggest that every subclass of monitor
should call stop()
explicitly.
The destructor calling stop()
was meant as a safety net: each monitor should be stopped gracefully with stop()
. The C binding is missing a stop()
function and that's what I think we should add for starters.
Created #143 to provide a mean to stop a monitor from the C API.
I'm considering updating the monitor
behaviour to fail in some way (probably call std::terminate
) if a monitor is destroyed while still running.