fswatch icon indicating copy to clipboard operation
fswatch copied to clipboard

`on_stop()` is not called on destruction of a monitor

Open Andrepuel opened this issue 8 years ago • 3 comments

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.

Andrepuel avatar Sep 22 '16 01:09 Andrepuel

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.

emcrisostomo avatar Sep 24 '16 16:09 emcrisostomo

Created #143 to provide a mean to stop a monitor from the C API.

emcrisostomo avatar Nov 20 '16 18:11 emcrisostomo

I'm considering updating the monitor behaviour to fail in some way (probably call std::terminate) if a monitor is destroyed while still running.

emcrisostomo avatar Nov 20 '16 18:11 emcrisostomo