* pure function or as an object. It is very simple with functions:
*
* @code{.cpp}
- * #include "s4u/actor.hpp"
+ * #include <simgrid/s4u/actor.hpp>
*
* // Declare the code of your worker
* void worker() {
* The syntax is slightly more complicated, but not much.
*
* @code{.cpp}
- * #include "s4u/actor.hpp"
+ * #include <simgrid/s4u/actor.hpp>
*
* // Declare the class representing your actors
* class Worker {
*/
/** @brief Simulation Agent */
-XBT_PUBLIC_CLASS Actor : public simgrid::xbt::Extendable<Actor>
-{
+class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
friend Exec;
friend Mailbox;
- friend simgrid::simix::ActorImpl;
+ friend simgrid::kernel::actor::ActorImpl;
friend simgrid::kernel::activity::MailboxImpl;
- simix::ActorImpl* pimpl_ = nullptr;
+ kernel::actor::ActorImpl* pimpl_ = nullptr;
/** Wrap a (possibly non-copyable) single-use task into a `std::function` */
template<class F, class... Args>
/** Returns whether or not this actor has been daemonized or not **/
bool isDaemon();
+ XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_name()") const simgrid::xbt::string& getName() const
+ {
+ return get_name();
+ }
+ XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_cname()") const char* getCname() const { return get_cname(); }
+
/** Retrieves the name of that actor as a C++ string */
- const simgrid::xbt::string& getName() const;
+ const simgrid::xbt::string& get_name() const;
/** Retrieves the name of that actor as a C string */
- const char* getCname() const;
+ const char* get_cname() const;
/** Retrieves the host on which that actor is running */
s4u::Host* getHost();
/** Retrieves the PID of that actor
*
- * actor_id_t is an alias for unsigned long */
+ * aid_t is an alias for long */
aid_t getPid();
/** Retrieves the PPID of that actor
*
- * actor_id_t is an alias for unsigned long */
+ * aid_t is an alias for long */
aid_t getPpid();
/** Suspend an actor by suspending the task on which it was waiting for the completion. */
/** Resume a suspended actor by resuming the task on which it was waiting for the completion. */
void resume();
-
+
void yield();
-
+
/** Returns true if the actor is suspended. */
int isSuspended();
static void killAll(int resetPid);
/** Returns the internal implementation of this actor */
- simix::ActorImpl* getImpl();
+ kernel::actor::ActorImpl* getImpl();
/** Retrieve the property value (or nullptr if not set) */
std::map<std::string, std::string>* getProperties();
this_actor::sleep_until(timeout_native.time_since_epoch().count());
}
-XBT_ATTRIB_DEPRECATED_v320("Use sleep_for(): v3.20 will turn this warning into an error.") inline void sleep(
- double duration)
-{
- return sleep_for(duration);
-}
-
/** Block the actor, computing the given amount of flops */
XBT_PUBLIC void execute(double flop);
XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
XBT_PUBLIC ExecPtr exec_async(double flops_amounts);
-/** Block the actor until it gets a message from the given mailbox.
- *
- * See \ref Comm for the full communication API (including non blocking communications).
- */
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will turn this warning into an error.") XBT_PUBLIC
- void* recv(MailboxPtr chan);
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will turn this warning into an error.") XBT_PUBLIC
- void* recv(MailboxPtr chan, double timeout);
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::recv_async(): v3.20 will turn this warning into an error.") XBT_PUBLIC CommPtr
- irecv(MailboxPtr chan, void** data);
-
-/** Block the actor until it delivers a message of the given simulated size to the given mailbox
- *
- * See \ref Comm for the full communication API (including non blocking communications).
-*/
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will turn this warning into an error.") XBT_PUBLIC
- void send(MailboxPtr chan, void* payload, double simulatedSize);
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will turn this warning into an error.") XBT_PUBLIC
- void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout);
-
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will turn this warning into an error.") XBT_PUBLIC CommPtr
- isend(MailboxPtr chan, void* payload, double simulatedSize);
-
/** @brief Returns the actor ID of the current actor). */
XBT_PUBLIC aid_t getPid();
XBT_PUBLIC aid_t getPpid();
/** @brief Returns the name of the current actor. */
-XBT_PUBLIC std::string getName();
-
+XBT_PUBLIC std::string get_name();
/** @brief Returns the name of the current actor as a C string. */
-XBT_PUBLIC const char* getCname();
+XBT_PUBLIC const char* get_cname();
+
+XBT_ATTRIB_DEPRECATED_v323("Please use this_actor::get_name()") XBT_PUBLIC std::string getName();
+XBT_ATTRIB_DEPRECATED_v323("Please use this_actor::get_cname()") XBT_PUBLIC const char* getCname();
/** @brief Returns the name of the host on which the actor is running. */
XBT_PUBLIC Host* getHost();