From: donassbr Date: Thu, 8 Apr 2010 17:31:14 +0000 (+0000) Subject: Add 2 new functions to manage actions (SIMIX_action_resume/SIMIX_action_suspend). X-Git-Tag: SVN~253 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1d83762040b2315fb5f9944708416945cec72f68 Add 2 new functions to manage actions (SIMIX_action_resume/SIMIX_action_suspend). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7487 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index 97eb4d0834..2392b6bc00 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -165,6 +165,8 @@ XBT_PUBLIC(smx_action_t) SIMIX_action_sleep(smx_host_t host, double amount); XBT_PUBLIC(void) SIMIX_action_cancel(smx_action_t action); XBT_PUBLIC(void) SIMIX_action_set_priority(smx_action_t action, double priority); +XBT_PUBLIC(void) SIMIX_action_resume(smx_action_t action); +XBT_PUBLIC(void) SIMIX_action_suspend(smx_action_t action); XBT_PUBLIC(int) SIMIX_action_destroy(smx_action_t action); XBT_PUBLIC(void) SIMIX_action_use(smx_action_t action); XBT_PUBLIC(void) SIMIX_action_release(smx_action_t action); diff --git a/src/simix/smx_action.c b/src/simix/smx_action.c index 7984882150..b4a3b67921 100644 --- a/src/simix/smx_action.c +++ b/src/simix/smx_action.c @@ -184,6 +184,36 @@ XBT_INLINE void SIMIX_action_set_priority(smx_action_t action, double priority) return; } +/** + * \brief Resumes the execution of an action. + * + * This functions restarts the execution of an action. It just calls the right SURF function. + * \param action The SIMIX action + * \param priority The new priority + */ +XBT_INLINE void SIMIX_action_resume(smx_action_t action) +{ + xbt_assert0((action != NULL), "Invalid parameter"); + + surf_workstation_model->resume(action->surf_action); + return; +} + +/** + * \brief Suspends the execution of an action. + * + * This functions suspends the execution of an action. It just calls the right SURF function. + * \param action The SIMIX action + * \param priority The new priority + */ +XBT_INLINE void SIMIX_action_suspend(smx_action_t action) +{ + xbt_assert0((action != NULL), "Invalid parameter"); + + surf_workstation_model->suspend(action->surf_action); + return; +} + /** * \brief Destroys an action *