- /** Add a callback fired when an actor is about to disappear (its destructor was called).
- * This signal is fired for any destructed actor, which is mostly useful when designing plugins and extensions.
- * If you want to react to the end of the actor's code, use Actor::on_termination instead.
- * If you want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
+ /** Add a callback fired when this specific actor terminates its code.
+ * @beginrst
+ * The actor may continue to exist if it is still referenced in the simulation, but it's not active anymore.
+ * If you want to free extra data when the actor's destructor is called, use :cpp:func:`Actor::on_this_destruction_cb`.
+ * @endrst
+ */
+ void on_this_termination_cb(const std::function<void(Actor const&)>& cb) { on_this_termination.connect(cb); }
+ /** \static Add a callback fired when an actor is about to disappear (its destructor was called).
+ * This signal is fired for any destructed actor, which is mostly useful when designing plugins and extensions. */