* \brief Destroy a #m_task_t.
*
* Destructor for #m_task_t. Note that you should free user data, if any, \b
- before calling this function.
+ * before calling this function.
+ *
+ * Only the process that owns the task can destroy it.
+ * The owner changes after a successful send.
+ * If a task is successfully sent, the receiver becomes the owner and is
+ * supposed to destroy it. The sender should not use it anymore.
+ * If the task failed to be sent, the sender remains the owner of the task.
*/
MSG_error_t MSG_task_destroy(m_task_t task)
{
xbt_assert((task != NULL), "Invalid parameter");
if (task->simdata->isused) {
- /* the task is still being used, it may be an unfinished dsend */
+ /* the task is being sent or executed: cancel it first */
MSG_task_cancel(task);
}
#ifdef HAVE_TRACING