- MPI_Op_commutative, MPI_Fetch_and_Op, MPI_Compare_and_swap
- MPI_Rput, MPI_Rget, MPI_Raccumulate, MPI_Rget_accumulate
+ S4U
+ - New: this_actor::isMaestro() returns whether we are in kernel mode.
+
XBT
- Replay: New function xbt_replay_action_get():
Retrieve the function previously associated to an event type.
* @brief Static methods working on the current actor (see @ref s4u::Actor) */
namespace this_actor {
- /** Block the actor sleeping for that amount of seconds (may throws hostFailure) */
- XBT_PUBLIC(void) sleep_for(double duration);
- XBT_PUBLIC(void) sleep_until(double timeout);
+XBT_PUBLIC(bool) isMaestro();
- template<class Rep, class Period>
- inline void sleep_for(std::chrono::duration<Rep, Period> duration)
- {
- auto seconds = std::chrono::duration_cast<SimulationClockDuration>(duration);
- this_actor::sleep_for(seconds.count());
+/** Block the actor sleeping for that amount of seconds (may throws hostFailure) */
+XBT_PUBLIC(void) sleep_for(double duration);
+XBT_PUBLIC(void) sleep_until(double timeout);
+
+template <class Rep, class Period> inline void sleep_for(std::chrono::duration<Rep, Period> duration)
+{
+ auto seconds = std::chrono::duration_cast<SimulationClockDuration>(duration);
+ this_actor::sleep_for(seconds.count());
}
template<class Duration>
inline void sleep_until(const SimulationTimePoint<Duration>& timeout_time)
namespace this_actor {
+/** Returns true if run from the kernel mode, and false if run from a real actor
+ *
+ * Everything that is run out of any actor (simulation setup before the engine is run,
+ * computing the model evolutions as a result to the actors' action, etc) is run in
+ * kernel mode, just as in any operating systems.
+ *
+ * In SimGrid, the actor in charge of doing the stuff in kernel mode is called Maestro,
+ * because it is the one scheduling when the others should move or wait.
+ */
+bool isMaestro()
+{
+ smx_context_t self_context = SIMIX_context_self();
+ return self_context == nullptr;
+}
+
void sleep_for(double duration)
{
if (duration > 0)