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"
12 #include "src/simix/popping_private.h"
14 /** @brief Executes all the processes to run (in parallel if possible). */
15 static inline void SIMIX_context_runall(void)
17 if (!xbt_dynar_is_empty(simix_global->process_to_run))
18 simix_global->context_factory->run_all();
21 /** @brief returns the current running context */
22 static inline smx_context_t SIMIX_context_self(void)
24 if (simix_global && simix_global->context_factory)
25 return simix_global->context_factory->self();
33 XBT_PRIVATE ContextFactory* thread_factory();
34 XBT_PRIVATE ContextFactory* sysv_factory();
35 XBT_PRIVATE ContextFactory* raw_factory();
36 XBT_PRIVATE ContextFactory* boost_factory();
38 template<class R, class... Args> inline
39 R simcall(e_smx_simcall_t call, Args&&... args)
41 smx_process_t self = SIMIX_process_self();
42 marshal(&self->simcall, call, std::forward<Args>(args)...);
44 return unmarshal<R>(self->simcall.result);