From a48d223f9273f17a0941c576b578a3bbeb04f09f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christophe=20Thi=C3=A9ry?= Date: Mon, 25 Jul 2011 14:48:19 +0200 Subject: [PATCH 1/1] Don't throw the impossible when the user cancels a non-running task --- src/msg/task.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/msg/task.c b/src/msg/task.c index 2908b353fe..6d3065f942 100644 --- a/src/msg/task.c +++ b/src/msg/task.c @@ -189,7 +189,7 @@ MSG_error_t MSG_task_destroy(m_task_t task) /** \ingroup m_task_management * \brief Cancel a #m_task_t. - * \param task the taskt to cancel. If it was executed or transfered, it + * \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) @@ -198,13 +198,14 @@ MSG_error_t MSG_task_cancel(m_task_t task) if (task->simdata->compute) { SIMIX_req_host_execution_cancel(task->simdata->compute); - return MSG_OK; } - if (task->simdata->comm) { + else if (task->simdata->comm) { SIMIX_req_comm_cancel(task->simdata->comm); - return MSG_OK; } - THROW_IMPOSSIBLE; + else { + XBT_DEBUG("Task %p will not be cancelled since it is not running", task); + } + return MSG_OK; } /** \ingroup m_task_management -- 2.20.1