-/**
- * @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);
-}
-
-/**
- * @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.
- *
- * The maxrate parameter can be used to send a task with a limited
- * bandwidth (smaller than the physical available value). Use
- * MSG_task_send() if you don't limit the rate (or pass -1 as a rate
- * value do disable this feature).
- *
- * @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 (byte/sec)
- *
- * @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);
-}
-
-/**
- * @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;
-
- TRACE_msg_task_put_start(task);
-
- /* Prepare the task to send */
- simdata_task_t t_simdata = task->simdata;
- t_simdata->sender = MSG_process_self();
- t_simdata->source = MSG_host_self();
- t_simdata->setUsed();
-
- msg_global->sent_msg++;
-
- /* Try to send it */
- try {
- simgrid::s4u::CommPtr comm =
- simgrid::s4u::Mailbox::by_name(alias)->put_init(task, t_simdata->bytes_amount)->set_rate(t_simdata->rate);
- t_simdata->comm = comm;
- comm->start();
- if (TRACE_is_enabled() && task->category != nullptr)
- simgrid::simix::simcall([comm, task] { comm->get_impl()->set_category(task->category); });
- comm->wait_for(timeout);
- } catch (simgrid::TimeoutError& e) {
- ret = MSG_TIMEOUT;
- } catch (simgrid::CancelException& e) {
- ret = MSG_HOST_FAILURE;
- } catch (xbt_ex& e) {
- if (e.category == network_error)
- ret = MSG_TRANSFER_FAILURE;
- else
- throw;
-
- /* If the send failed, it is not used anymore */
- t_simdata->setNotUsed();
- }
-
- return ret;
-}
-
-/**
- * @brief Sends a task to a mailbox with a timeout and with a maximum rate
- *
- * This is a blocking function, the execution flow will be blocked until the task is sent or the timeout is achieved.
- *
- * The maxrate parameter can be used to send a task with a limited
- * bandwidth (smaller than the physical available value). Use
- * MSG_task_send_with_timeout() if you don't limit the rate (or pass -1 as a rate
- * value do disable this feature).
- *
- * @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)
- * @param maxrate the maximum communication rate for sending this task (byte/sec)
- *
- * @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_bounded(msg_task_t task, const char *alias, double timeout, double maxrate)
-{
- task->simdata->rate = maxrate;
- return MSG_task_send_with_timeout(task, alias, timeout);
-}
-