/* 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. */
-#ifndef SIMGRID_S4U_ASYNC_HPP
-#define SIMGRID_S4U_ASYNC_HPP
+#ifndef SIMGRID_S4U_ACTIVITY_HPP
+#define SIMGRID_S4U_ACTIVITY_HPP
#include <stdlib.h>
#include <xbt/base.h>
SG_BEGIN_DECL();
typedef enum {
inited, started, finished
-} e_s4u_async_state_t;
+} e_s4u_activity_state_t;
SG_END_DECL();
namespace simgrid {
namespace s4u {
-/** @brief Asynchronous Actions
+/** @brief Activities
*
- * This class is the ancestor of every asynchronous actions, that is, of actions that do take time in the simulated world.
+ * This class is the ancestor of every activities that an actor can undertake, that is, of the actions that do take time in the simulated world.
*/
-XBT_PUBLIC_CLASS Async {
+XBT_PUBLIC_CLASS Activity {
friend Comm;
protected:
- Async();
- virtual ~Async();
+ Activity();
+ virtual ~Activity();
private:
simgrid::simix::Synchro *pimpl_ = NULL;
private:
- e_s4u_async_state_t state_ = inited;
+ e_s4u_activity_state_t state_ = inited;
public:
- /** Starts a previously created async.
+ /** Starts a previously created activity.
*
* This function is optional: you can call wait() even if you didn't call start()
*/
virtual void start()=0;
- /** Tests whether the given async is terminated yet */
+ /** Tests whether the given activity is terminated yet. This is a pure function. */
//virtual bool test()=0;
- /** Blocks until the async is terminated */
+ /** Blocks until the activity is terminated */
virtual void wait()=0;
- /** Blocks until the async is terminated, or until the timeout is elapsed
+ /** Blocks until the activity is terminated, or until the timeout is elapsed
* Raises: timeout exception.*/
virtual void wait(double timeout)=0;
- /** Cancel that async */
+ /** Cancel that activity */
//virtual void cancel();
- /** Retrieve the current state of the async */
- e_s4u_async_state_t getState() {return state_;}
+ /** Retrieve the current state of the activity */
+ e_s4u_activity_state_t getState() {return state_;}
private:
double remains_ = 0;
public:
- /** Get the remaining amount of work that this Async entails. When it's 0, it's done. */
+ /** Get the remaining amount of work that this Activity entails. When it's 0, it's done. */
double getRemains();
- /** Set the [remaining] amount of work that this Async will entail
+ /** Set the [remaining] amount of work that this Activity will entail
*
- * It is forbidden to change the amount of work once the Async is started */
+ * It is forbidden to change the amount of work once the Activity is started */
void setRemains(double remains);
private:
void *userData_ = NULL;
public:
- /** Put some user data onto the Async */
+ /** Put some user data onto the Activity */
void setUserData(void *data) {userData_=data;}
- /** Retrieve the user data of the Async */
+ /** Retrieve the user data of the Activity */
void *getUserData() { return userData_; }
}; // class
}}; // Namespace simgrid::s4u
-#endif /* SIMGRID_S4U_ASYNC_HPP */
+#endif /* SIMGRID_S4U_ACTIVITY_HPP */