Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
privatize ExecImpl::timeoutDetector and partially ExecImpl::surfAction
[simgrid.git] / src / kernel / activity / ExecImpl.hpp
1 /* Copyright (c) 2007-2018. 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 SIMIX_SYNCHRO_EXEC_HPP
7 #define SIMIX_SYNCHRO_EXEC_HPP
8
9 #include "src/kernel/activity/ActivityImpl.hpp"
10 #include "surf/surf.hpp"
11
12 namespace simgrid {
13 namespace kernel {
14 namespace activity {
15
16 class XBT_PUBLIC ExecImpl : public ActivityImpl {
17   ~ExecImpl() override;
18
19 public:
20   explicit ExecImpl(const char* name, resource::Action* surf_action, resource::Action* timeout_detector,
21                     s4u::Host* host);
22   void suspend() override;
23   void resume() override;
24   void cancel();
25   void post() override;
26   double get_remaining();
27   double get_remaining_ratio();
28   void set_bound(double bound);
29   void set_priority(double priority);
30   virtual ActivityImpl* migrate(s4u::Host* to);
31
32   /* The host where the execution takes place. nullptr means this is a parallel exec (and only surf knows the hosts) */
33   s4u::Host* host_ = nullptr;
34   resource::Action* surfAction_; /* The Surf execution action encapsulated */
35 private:
36   resource::Action* timeoutDetector = nullptr;
37
38 public:
39   static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCreation;
40   static simgrid::xbt::signal<void(kernel::activity::ExecImplPtr)> onCompletion;
41   static simgrid::xbt::signal<void(simgrid::kernel::activity::ExecImplPtr, simgrid::s4u::Host*)> onMigration;
42
43 };
44 }
45 }
46 } // namespace simgrid::kernel::activity
47 #endif