/** @brief Simulation Agent */
class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
-#ifndef DOXYGEN
- friend Exec;
- friend Mailbox;
+ friend simgrid::s4u::Exec;
+ friend simgrid::s4u::Mailbox;
friend simgrid::kernel::actor::ActorImpl;
friend simgrid::kernel::activity::MailboxImpl;
-#endif
+
kernel::actor::ActorImpl* pimpl_ = nullptr;
explicit Actor(smx_actor_t pimpl) : pimpl_(pimpl) {}
- typedef std::function<void()> callback_type;
-
public:
// ***** No copy *****
*
* If the actor is restarted, the actor has a fresh copy of the function.
*/
- static ActorPtr create(std::string name, s4u::Host* host, callback_type code);
+ static ActorPtr create(std::string name, s4u::Host* host, std::function<void()> code);
/** Create an actor from a std::function
*
*/
template <class F> static ActorPtr create(std::string name, s4u::Host* host, F code)
{
- return create(name, host, callback_type(std::move(code)));
+ return create(name, host, std::function<void()>(std::move(code)));
}
/** Create an actor using a callable thing and its arguments.
*/
void kill();
+ /** Kill an actor from its ID */
static void kill(aid_t pid);
/** Retrieves the actor that have the given PID (or nullptr if not existing) */
/** @brief kill the actor. */
XBT_PUBLIC void exit();
-#ifndef DOXYGEN
-/** @deprecated Please use std::function<void(int, void*)> for first parameter */
-XBT_ATTRIB_DEPRECATED_v323("Please use std::function<void(int, void*)> for first parameter.") XBT_PUBLIC
- void on_exit(int_f_pvoid_pvoid_t fun, void* data);
/** @brief Add a function to the list of "on_exit" functions. */
XBT_PUBLIC void on_exit(std::function<void(int, void*)> fun, void* data);
/** @brief Migrate the actor to a new host. */
XBT_PUBLIC void migrate(Host* new_host);
+/** @} */
+
+#ifndef DOXYGEN
+/** @deprecated Please use std::function<void(int, void*)> for first parameter */
+XBT_ATTRIB_DEPRECATED_v323("Please use std::function<void(int, void*)> for first parameter.") XBT_PUBLIC
+ void on_exit(int_f_pvoid_pvoid_t fun, void* data);
/** @deprecated See this_actor::get_name() */
XBT_ATTRIB_DEPRECATED_v323("Please use this_actor::get_name()") XBT_PUBLIC std::string getName();
/** @deprecated See this_actor::get_cname() */
#endif
}
-/** @} */
}} // namespace simgrid::s4u