Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add dag scheduling lab
[simgrid.git] / src / kernel / activity / CommImpl.hpp
index 3912d237280114a0e83e36a17d6e1b5e70cc79bb..32fef45acff64415147a9fe5017982bff2859059 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 #include "src/kernel/actor/ActorImpl.hpp"
 #include "src/kernel/actor/CommObserver.hpp"
 
-namespace simgrid {
-namespace kernel {
-namespace activity {
+namespace simgrid::kernel::activity {
 
 enum class CommImplType { SEND, RECEIVE };
 
+using timeout_action_type = std::unique_ptr<resource::Action, std::function<void(resource::Action*)>>;
+
 class XBT_PUBLIC CommImpl : public ActivityImpl_T<CommImpl> {
   ~CommImpl() override;
-  void cleanup_surf();
 
   static std::function<void(CommImpl*, void*, size_t)> copy_data_callback_;
 
@@ -71,7 +70,6 @@ public:
   void suspend() override;
   void resume() override;
   void cancel() override;
-  void post() override;
   void set_exception(actor::ActorImpl* issuer) override;
   void finish() override;
 
@@ -81,9 +79,10 @@ looking if a given communication matches my needs. For that, myself must match t
 expectations of the other side, too. See  */
   std::function<void(CommImpl*, void*, size_t)> copy_data_fun;
 
-  /* Surf action data */
-  resource::Action* src_timeout_ = nullptr; /* Surf's actions to instrument the timeouts */
-  resource::Action* dst_timeout_ = nullptr; /* Surf's actions to instrument the timeouts */
+  /* Model actions */
+  timeout_action_type src_timeout_{nullptr, [](resource::Action* a) { a->unref(); }}; /* timeout set by the sender */
+  timeout_action_type dst_timeout_{nullptr, [](resource::Action* a) { a->unref(); }}; /* timeout set by the receiver */
+
   actor::ActorImplPtr src_actor_ = nullptr;
   actor::ActorImplPtr dst_actor_ = nullptr;
 
@@ -98,8 +97,6 @@ expectations of the other side, too. See  */
   static xbt::signal<void(CommImpl const&)> on_start;
   static xbt::signal<void(CommImpl const&)> on_completion;
 };
-} // namespace activity
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::activity
 
 #endif