1 /* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef SIMGRID_SIMIX_PRIVATE_HPP
8 #define SIMGRID_SIMIX_PRIVATE_HPP
10 #include <simgrid/simix.hpp>
11 #include "smx_private.h"
14 * \brief destroy a context
15 * \param context the context to destroy
16 * Argument must be stopped first -- runs in maestro context
18 static XBT_INLINE void SIMIX_context_free(smx_context_t context)
24 * \brief stops the execution of a context
25 * \param context to stop
27 static XBT_INLINE void SIMIX_context_stop(smx_context_t context)
33 \brief suspends a context and return the control back to the one which
35 \param context the context to be suspended (it must be the running one)
37 static XBT_INLINE void SIMIX_context_suspend(smx_context_t context)
43 \brief Executes all the processes to run (in parallel if possible).
45 static XBT_INLINE void SIMIX_context_runall(void)
47 if (!xbt_dynar_is_empty(simix_global->process_to_run))
48 simix_global->context_factory->run_all();
52 \brief returns the current running context
54 static XBT_INLINE smx_context_t SIMIX_context_self(void)
56 if (simix_global && simix_global->context_factory)
57 return simix_global->context_factory->self();
63 \brief returns the SIMIX process associated to a context
64 \param context The context
65 \return The SIMIX process
67 static XBT_INLINE smx_process_t SIMIX_context_get_process(smx_context_t context)
69 return context->process();
75 XBT_PRIVATE ContextFactory* thread_factory();
76 XBT_PRIVATE ContextFactory* sysv_factory();
77 XBT_PRIVATE ContextFactory* raw_factory();
78 XBT_PRIVATE ContextFactory* boost_factory();