XBT_PUBLIC(void) *smx_ctx_base_get_data(smx_context_t context);
XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable(void);
+XBT_PUBLIC(smx_process_t) SIMIX_process_from_PID(int PID);
/* parallelism */
XBT_INLINE int SIMIX_context_is_parallel(void);
*/
m_process_t MSG_process_from_PID(int PID)
{
- /* FIXME: reimplement this function using SIMIX when we have a good PID.
- * In the meantime, I guess nobody uses it so it should not break anything. */
- THROW_UNIMPLEMENTED;
+ return SIMIX_process_from_PID(PID);
}
/** \ingroup m_process_management
{
return simix_global->process_to_run;
}
+
+/**
+ * \brief Returns the process from PID.
+ */
+smx_process_t SIMIX_process_from_PID(int PID)
+{
+ smx_process_t proc;
+ xbt_swag_foreach(proc, simix_global->process_list)
+ {
+ if(proc->pid == PID)
+ return proc;
+ }
+ return NULL;
+}