- msg_global->task_copy_callback(task, comm->src_proc->ciface(), comm->dst_proc->ciface());
- }
-}
-
-/** \ingroup msg_task_usage
- * \brief Sends a task to a mailbox
- *
- * This is a blocking function, the execution flow will be blocked until the task is sent (and received on the other
- * side if #MSG_task_receive is used).
- * See #MSG_task_isend for sending tasks asynchronously.
- *
- * \param task the task to be sent
- * \param alias the mailbox name to where the task is sent
- *
- * \return Returns #MSG_OK if the task was successfully sent,
- * #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE otherwise.
- */
-msg_error_t MSG_task_send(msg_task_t task, const char *alias)
-{
- XBT_DEBUG("MSG_task_send: Trying to send a message on mailbox '%s'", alias);
- return MSG_task_send_with_timeout(task, alias, -1);
-}
-
-/** \ingroup msg_task_usage
- * \brief Sends a task to a mailbox with a maximum rate
- *
- * This is a blocking function, the execution flow will be blocked until the task is sent. The maxrate parameter allows
- * the application to limit the bandwidth utilization of network links when sending the task.
- *
- * \param task the task to be sent
- * \param alias the mailbox name to where the task is sent
- * \param maxrate the maximum communication rate for sending this task
- *
- * \return Returns #MSG_OK if the task was successfully sent,
- * #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE otherwise.
- */
-msg_error_t MSG_task_send_bounded(msg_task_t task, const char *alias, double maxrate)
-{
- task->simdata->rate = maxrate;
- return MSG_task_send(task, alias);
-}
-
-/** \ingroup msg_task_usage
- * \brief Sends a task to a mailbox with a timeout
- *
- * This is a blocking function, the execution flow will be blocked until the task is sent or the timeout is achieved.
- *
- * \param task the task to be sent
- * \param alias the mailbox name to where the task is sent
- * \param timeout is the maximum wait time for completion (if -1, this call is the same as #MSG_task_send)
- *
- * \return Returns #MSG_OK if the task was successfully sent,
- * #MSG_HOST_FAILURE, or #MSG_TRANSFER_FAILURE, or #MSG_TIMEOUT otherwise.
- */
-msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout)
-{
- msg_error_t ret = MSG_OK;
- simdata_task_t t_simdata = nullptr;
- msg_process_t process = MSG_process_self();
- simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
-
- int call_end = TRACE_msg_task_put_start(task);
-
- /* Prepare the task to send */
- t_simdata = task->simdata;
- t_simdata->sender = process;
- t_simdata->source = MSG_host_self();
-
- t_simdata->setUsed();
-
- t_simdata->comm = nullptr;
- msg_global->sent_msg++;
-
- /* Try to send it by calling SIMIX network layer */
- try {
- smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simix call */
- comm = simcall_comm_isend(SIMIX_process_self(), mailbox->getImpl(),t_simdata->bytes_amount,
- t_simdata->rate, task, sizeof(void *), nullptr, nullptr, nullptr, task, 0);
- if (TRACE_is_enabled())
- simcall_set_category(comm, task->category);
- t_simdata->comm = boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(comm);
- simcall_comm_wait(comm, timeout);