/** @brief Simulation Agent */
class XBT_PUBLIC Actor : public xbt::Extendable<Actor> {
+#ifndef DOXYGEN
friend Exec;
friend Mailbox;
friend kernel::actor::ActorImpl;
friend kernel::activity::MailboxImpl;
kernel::actor::ActorImpl* const pimpl_;
+#endif
explicit Actor(smx_actor_t pimpl) : pimpl_(pimpl) {}
// ***** Reference count *****
friend XBT_PUBLIC void intrusive_ptr_add_ref(Actor * actor);
friend XBT_PUBLIC void intrusive_ptr_release(Actor * actor);
+ int get_refcount();
// ***** Actor creation *****
/** Retrieve a reference to myself */
static Actor* self();
- /** Signal to others that a new actor has been created **/
+ /** Fired when a new actor has been created **/
static xbt::signal<void(Actor&)> on_creation;
/** Signal to others that an actor has been suspended**/
static xbt::signal<void(Actor const&)> on_suspend;
static xbt::signal<void(Actor const&)> on_migration_start;
/** Signal to others that an actor is has been migrated to another host **/
static xbt::signal<void(Actor const&)> on_migration_end;
- /** Signal indicating that an actor is about to disappear.
- * This signal is fired for any dying actor, which is mostly useful when designing plugins and extensions. If you
- * want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
+ /** Signal indicating that an actor terminated its code.
+ * 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 Actor::on_destruction.
+ * If you want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
+ static xbt::signal<void(Actor const&)> on_termination;
+ /** Signal indicating that 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.*/
static xbt::signal<void(Actor const&)> on_destruction;
/** Create an actor from a std::function<void()>
/** @brief Returns the name of the current actor as a C string. */
XBT_PUBLIC const char* get_cname();
-/** @brief Returns the name of the host on which the curret actor is running. */
+/** @brief Returns the name of the host on which the current actor is running. */
XBT_PUBLIC Host* get_host();
/** @brief Suspend the current actor, that is blocked until resume()ed by another actor. */