Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define (and use) a callback for RawImpl::finish.
[simgrid.git] / src / kernel / activity / SynchroRaw.hpp
index 62b62bc..b4ed393 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2021. 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. */
@@ -8,6 +8,7 @@
 
 #include "src/kernel/activity/ActivityImpl.hpp"
 #include "surf/surf.hpp"
+#include <functional>
 
 namespace simgrid {
 namespace kernel {
@@ -17,10 +18,12 @@ namespace activity {
 class XBT_PUBLIC RawImpl : public ActivityImpl_T<RawImpl> {
   sg_host_t host_ = nullptr;
   double timeout_ = -1;
+  std::function<void()> finish_callback_;
 
 public:
+  explicit RawImpl(const std::function<void()>& finish_callback) : finish_callback_(finish_callback) {}
   RawImpl& set_host(s4u::Host* host);
-  RawImpl& set_timeout(double timeout);
+  RawImpl& set_timeout(double timeout) override;
 
   RawImpl* start();
   void suspend() override;