-/* if (task == NULL) { /\* Fatal *\/ */
-/* WARNING("Task uninitialized"); */
-/* return MSG_FATAL; */
-/* } */
-/* simdata = task->simdata; */
+/** \ingroup m_task_management
+ * \brief Cancel a #m_task_t.
+ * \param task the task to cancel. If it was executed or transfered, it
+ stops the process that were working on it.
+ */
+MSG_error_t MSG_task_cancel(m_task_t task)
+{
+ xbt_assert((task != NULL), "Invalid parameter");
+
+ if (task->simdata->compute) {
+ SIMIX_req_host_execution_cancel(task->simdata->compute);
+ }
+ else if (task->simdata->comm) {
+ SIMIX_req_comm_cancel(task->simdata->comm);
+ task->simdata->isused = 0;
+ }
+ else {
+ static int warned = 0;
+ if (!warned) {
+ XBT_WARN("Cannot cancel a non-running task");
+ warned = 1;
+ }
+ }
+ return MSG_OK;
+}
+
+/** \ingroup m_task_management
+ * \brief Returns the computation amount needed to process a task #m_task_t.
+ * Once a task has been processed, this amount is thus set to 0...
+ */
+double MSG_task_get_compute_duration(m_task_t task)
+{
+ xbt_assert((task != NULL)
+ && (task->simdata != NULL), "Invalid parameter");