From: Christophe ThiƩry Date: Thu, 27 Oct 2011 17:15:56 +0000 (+0200) Subject: Make suspending/resuming a suspended/non-suspended process a no-op X-Git-Tag: exp_20120216~540^2~6 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4e0c8570051df3f7114e0097bf888a99946b6138?hp=87095ad793add2395ed116d77496831460990770 Make suspending/resuming a suspended/non-suspended process a no-op --- diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 0b150c8e1b..ac73df56c1 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -316,6 +316,13 @@ void SIMIX_pre_process_suspend(smx_req_t req) void SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) { + xbt_assert((process != NULL), "Invalid parameters"); + + if (process->suspended) { + XBT_DEBUG("Process '%s' is already suspended", process->name); + return; + } + process->suspended = 1; /* If we are suspending another process, and it is waiting on an action, @@ -350,6 +357,11 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer) { xbt_assert((process != NULL), "Invalid parameters"); + if (!process->suspended) { + XBT_DEBUG("Process '%s' is not suspended", process->name); + return; + } + process->suspended = 0; /* If we are resuming another process, resume the action it was waiting for