From: alegrand Date: Tue, 18 Apr 2006 15:36:27 +0000 (+0000) Subject: Smarter assert in MSG_task_execute and take care of failures as suggested by X-Git-Tag: v3.3~3202 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6de34e70b28ae92d5cb2b4b33f094a0cc607eb64 Smarter assert in MSG_task_execute and take care of failures as suggested by Derrick. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2156 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/msg/gos.c b/src/msg/gos.c index dcc8e0c585..9fc31e846a 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -447,6 +447,13 @@ MSG_error_t MSG_task_put(m_task_t task, while(!(task_simdata->comm)) { DEBUG0("Communication not initiated yet. Let's block!"); __MSG_process_block(-1); + if(surf_workstation_resource->extension_public-> + get_state(remote_host->simdata->host) == SURF_CPU_OFF) { + xbt_fifo_remove(((simdata_host_t) remote_host->simdata)->mbox[channel], + task); + MSG_task_destroy(task); + MSG_RETURN(MSG_HOST_FAILURE); + } } DEBUG0("Registering to this communication"); surf_workstation_resource->common_public->action_use(task_simdata->comm); @@ -534,8 +541,9 @@ void __MSG_task_execute(m_process_t process, m_task_t task) CHECK_HOST(); simdata = task->simdata; - xbt_assert0(!simdata->compute,"This taks is executed somewhere else. Go fix your code!"); - + xbt_assert0((!simdata->compute)&&(task->simdata->using==1), + "This taks is executed somewhere else. Go fix your code!"); + task->simdata->using++; simdata->compute = surf_workstation_resource->extension_public-> execute(MSG_process_get_host(process)->simdata->host, simdata->computation_amount); @@ -543,6 +551,7 @@ void __MSG_task_execute(m_process_t process, m_task_t task) set_priority(simdata->compute, simdata->priority); surf_workstation_resource->common_public->action_set_data(simdata->compute,task); + task->simdata->using--; } MSG_error_t __MSG_wait_for_computation(m_process_t process, m_task_t task)