Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4e918a5ed8ccbd062239e688c8b2fd5c975651e0
[simgrid.git] / src / simix / popping_private.hpp
1 /* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SG_POPPING_PRIVATE_HPP
7 #define SG_POPPING_PRIVATE_HPP
8
9 #include "simgrid/forward.h"
10 #include "src/kernel/activity/ActivityImpl.hpp"
11
12 #include <array>
13 #include <boost/intrusive_ptr.hpp>
14
15 /********************************* Simcalls *********************************/
16 #include "popping_enum.hpp" /* Definition of Simcall, with one value per simcall */
17
18 XBT_PUBLIC_DATA const std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names; /* Name of each simcall */
19
20 using simix_match_func_t     = bool (*)(void*, void*, simgrid::kernel::activity::CommImpl*);
21 using simix_copy_data_func_t = void (*)(simgrid::kernel::activity::CommImpl*, void*, size_t);
22 using simix_clean_func_t     = void (*)(void*);
23
24 /**
25  * @brief Represents a simcall to the kernel.
26  */
27 struct s_smx_simcall {
28   simgrid::simix::Simcall call_                      = simgrid::simix::Simcall::NONE;
29   smx_actor_t issuer_                                = nullptr;
30   simgrid::kernel::timer::Timer* timeout_cb_         = nullptr; // Callback to timeouts
31   simgrid::kernel::actor::SimcallObserver* observer_ = nullptr; // makes that simcall observable by the MC
32   unsigned int mc_max_consider_ =
33       0; // How many times this simcall should be used. If >1, this will be a fork in the state space.
34   std::function<void()> const* code_      = nullptr;
35 };
36
37 /******************************** General *************************************/
38
39 XBT_PRIVATE const char* SIMIX_simcall_name(const s_smx_simcall& simcall);
40 XBT_PRIVATE void SIMIX_run_kernel(std::function<void()> const* code);
41 XBT_PRIVATE void SIMIX_run_blocking(std::function<void()> const* code);
42
43 #endif