X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/84ed556b8c7cf58207b813f2104075767c837d36..33ad1bb9ae9ed898b8786ea08d7910d5a162aff4:/src/msg/task.c diff --git a/src/msg/task.c b/src/msg/task.c index 067793cb7f..6d4bbbf65b 100644 --- a/src/msg/task.c +++ b/src/msg/task.c @@ -76,10 +76,15 @@ m_task_t MSG_task_create(const char *name, double compute_duration, return task; } +/** prevent the task from being destroyed too quickly (but also prevent it from being sent). Mainly useful in bindings */ +void MSG_task_ref(m_task_t t) { + t->simdata->refcount++; +} + /** \ingroup m_task_management * \brief Return the user data of a #m_task_t. * - * This functions checks whether \a task is a valid pointer or not and return + * This function checks whether \a task is a valid pointer or not and return the user data associated to \a task if it is possible. */ void *MSG_task_get_data(m_task_t task) @@ -89,6 +94,19 @@ void *MSG_task_get_data(m_task_t task) return (task->data); } +/** \ingroup m_task_management + * \brief Sets the user data of a #m_task_t. + * + * This function allows to associate a new pointer to + the user data associated of \a task. + */ +void MSG_task_set_data(m_task_t task,void *data) +{ + xbt_assert0((task != NULL), "Invalid parameter"); + + task->data = data; +} + /** \ingroup m_task_management * \brief Return the sender of a #m_task_t. *