Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replaced std::list by std::set to keep track of activities
[simgrid.git] / src / kernel / actor / Simcall.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 SIMGRID_SIMCALL_HPP
7 #define SIMGRID_SIMCALL_HPP
8
9 #include "simgrid/forward.h"
10 #include "xbt/utility.hpp"
11
12 namespace simgrid::kernel::actor {
13
14 /** Contains what's needed to run some code in kernel mode on behalf of an actor */
15 class Simcall {
16 public:
17   /** All possible simcalls. */
18   XBT_DECLARE_ENUM_CLASS(Type, NONE, RUN_ANSWERED, RUN_BLOCKING);
19
20   Type call_                                         = Type::NONE;
21   simgrid::kernel::actor::ActorImpl* issuer_         = nullptr;
22   simgrid::kernel::timer::Timer* timeout_cb_         = nullptr; // Callback to timeouts
23   simgrid::kernel::actor::SimcallObserver* observer_ = nullptr; // makes that simcall observable by the MC
24   std::function<void()> const* code_ = nullptr;
25
26   const char* get_cname() const;
27 };
28
29 /** A thing that can be used for an ObjectAccess simcall (getter or setter). */
30 class ObjectAccessSimcallItem {
31 public:
32   ObjectAccessSimcallItem();
33   void take_ownership();
34   ActorImpl* simcall_owner_;
35 };
36
37 } // namespace simgrid::kernel::actor
38
39 #endif