- /* why? if somebody is using, then you can't free! ok... but will return MSG_OK? when this task will be destroyed? isn't the user code wrong? */
- if (task->simdata->isused > 0) {
- XBT_DEBUG("Cannot destroy task %p since somebody is using it", task);
- return MSG_OK;
+ if (task->simdata->isused) {
+ /* the task is still being used, it may be an unfinished dsend */
+ MSG_task_cancel(task);