-/* Internal function used to factorize code between MSG_task_isend(), MSG_task_isend_bounded(), and MSG_task_dsend(). */
-static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* alias, void_f_pvoid_t cleanup,
- bool detached)
-{
- simdata_task_t t_simdata = nullptr;
- msg_process_t myself = MSG_process_self();
- simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias);
- TRACE_msg_task_put_start(task);
-
- /* Prepare the task to send */
- t_simdata = task->simdata;
- t_simdata->sender = myself;
- t_simdata->set_used();
- t_simdata->comm = nullptr;
- msg_global->sent_msg++;
-
- simgrid::s4u::CommPtr comm = mailbox->put_init(task, t_simdata->bytes_amount)->set_rate(t_simdata->rate);
- t_simdata->comm = comm;
- if (detached)
- comm->detach(cleanup);
- else
- comm->start();
-
- msg_comm_t msg_comm = nullptr;
- if (not detached) {
- msg_comm = new simgrid::msg::Comm(task, nullptr, comm);
- }
-
- if (TRACE_is_enabled() && task->category != nullptr)
- simgrid::simix::simcall([comm, task] { comm->get_impl()->set_category(task->category); });
-
- return msg_comm;
-}
-
-/**
- * @brief Sends a task on a mailbox.
- *
- * This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
- *
- * @param task a #msg_task_t to send on another location.
- * @param alias name of the mailbox to sent the task to
- * @return the msg_comm_t communication created
- */
-msg_comm_t MSG_task_isend(msg_task_t task, const char *alias)
-{
- return MSG_task_isend_internal(task, alias, nullptr, false);
-}
-
-/**
- * @brief Sends a task on a mailbox with a maximum rate
- *
- * This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication. The maxrate
- * parameter allows the application to limit the bandwidth utilization of network links when sending the task.
- *
- * @param task a #msg_task_t to send on another location.
- * @param alias name of the mailbox to sent the task to
- * @param maxrate the maximum communication rate for sending this task (byte/sec).
- * @return the msg_comm_t communication created
- */
-msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate)
-{
- task->simdata->rate = maxrate;
- return MSG_task_isend_internal(task, alias, nullptr, false);
-}
-
-/**
- * @brief Sends a task on a mailbox.
- *
- * This is a non blocking detached send function.
- * Think of it as a best effort send. Keep in mind that the third parameter is only called if the communication fails.
- * If the communication does work, it is responsibility of the receiver code to free anything related to the task, as
- * usual. More details on this can be obtained on
- * <a href="http://lists.gforge.inria.fr/pipermail/simgrid-user/2011-November/002649.html">this thread</a>
- * in the SimGrid-user mailing list archive.
- *
- * @param task a #msg_task_t to send on another location.
- * @param alias name of the mailbox to sent the task to
- * @param cleanup a function to destroy the task if the communication fails, e.g. MSG_task_destroy
- * (if nullptr, no function will be called)
- */
-void MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup)
-{
- msg_comm_t XBT_ATTRIB_UNUSED comm = MSG_task_isend_internal(task, alias, cleanup, true);
- xbt_assert(comm == nullptr);
-}
-
-/**
- * @brief Sends a task on a mailbox with a maximal rate.
- *
- * This is a non blocking detached send function.
- * Think of it as a best effort send. Keep in mind that the third parameter is only called if the communication fails.
- * If the communication does work, it is responsibility of the receiver code to free anything related to the task, as
- * usual. More details on this can be obtained on
- * <a href="http://lists.gforge.inria.fr/pipermail/simgrid-user/2011-November/002649.html">this thread</a>
- * in the SimGrid-user mailing list archive.
- *
- * The rate parameter can be used to send a task with a limited
- * bandwidth (smaller than the physical available value). Use
- * MSG_task_dsend() if you don't limit the rate (or pass -1 as a rate
- * value do disable this feature).
- *
- * @param task a #msg_task_t to send on another location.
- * @param alias name of the mailbox to sent the task to
- * @param cleanup a function to destroy the task if the
- * communication fails, e.g. MSG_task_destroy
- * (if nullptr, no function will be called)
- * @param maxrate the maximum communication rate for sending this task (byte/sec)
- *
- */
-void MSG_task_dsend_bounded(msg_task_t task, const char *alias, void_f_pvoid_t cleanup, double maxrate)
-{
- task->simdata->rate = maxrate;
- MSG_task_dsend(task, alias, cleanup);
-}