Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename the S4U method retrieving the internal impl to getImpl
[simgrid.git] / include / simgrid / s4u / actor.hpp
index 5039f84..28dbdc4 100644 (file)
@@ -247,8 +247,9 @@ public:
 
   /** Ask kindly to all actors to die. Only the issuer will survive. */
   static void killAll();
-  
-  smx_process_t getInferior();
+
+  /** Returns the internal implementation of this actor */
+  smx_process_t getImpl();
 };
 
 using ActorPtr = Actor::Ptr;
@@ -258,13 +259,26 @@ using ActorPtr = Actor::Ptr;
 namespace this_actor {
 
   /** Block the actor sleeping for that amount of seconds (may throws hostFailure) */
-  XBT_PUBLIC(void) sleep(double duration);
+  XBT_PUBLIC(void) sleep_for(double duration);
+  XBT_PUBLIC(void) sleep_until(double timeout);
 
   template<class Rep, class Period>
-  inline void sleep(std::chrono::duration<Rep, Period> duration)
+  inline void sleep_for(std::chrono::duration<Rep, Period> duration)
   {
     auto seconds = std::chrono::duration_cast<SimulationClockDuration>(duration);
-    sleep(seconds.count());
+    this_actor::sleep_for(seconds.count());
+  }
+  template<class Duration>
+  inline void sleep_until(const SimulationTimePoint<Duration>& timeout_time)
+  {
+    auto timeout_native = std::chrono::time_point_cast<SimulationClockDuration>(timeout_time);
+    this_actor::sleep_until(timeout_native.time_since_epoch().count());
+  }
+
+  XBT_ATTRIB_DEPRECATED("Use sleep_for()")
+  inline void sleep(double duration)
+  {
+    return sleep_for(duration);
   }
 
   /** Block the actor, computing the given amount of flops */