X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/900387d3c17ad331e7ce770590d07aca4be07c1d..16bbb8a8212497d9c44c81333ed2c0e689e0c5af:/include/simgrid/s4u/async.hpp diff --git a/include/simgrid/s4u/async.hpp b/include/simgrid/s4u/async.hpp index 37bd4e144f..6500b79640 100644 --- a/include/simgrid/s4u/async.hpp +++ b/include/simgrid/s4u/async.hpp @@ -15,7 +15,7 @@ SG_BEGIN_DECL(); typedef enum { - inited, started, finished + inited, started, finished } e_s4u_async_state_t; SG_END_DECL(); @@ -27,51 +27,51 @@ namespace s4u { * This class is the ancestor of every asynchronous actions, that is, of actions that do take time in the simulated world. */ XBT_PUBLIC_CLASS Async { - friend Comm; + friend Comm; protected: - Async(); - virtual ~Async(); - + Async(); + virtual ~Async(); + private: - struct s_smx_synchro *p_inferior = NULL; + struct s_smx_synchro *p_inferior = NULL; private: - e_s4u_async_state_t p_state = inited; + e_s4u_async_state_t p_state = inited; public: - /** Starts a previously created async. - * - * 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 */ - //virtual bool test()=0; - /** Blocks until the async is terminated */ - virtual void wait()=0; - /** Blocks until the async is terminated, or until the timeout is elapsed - * Raises: timeout exception.*/ - virtual void wait(double timeout)=0; - /** Cancel that async */ - //virtual void cancel(); - /** Retrieve the current state of the async */ - e_s4u_async_state_t getState() {return p_state;} + /** Starts a previously created async. + * + * 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 */ + //virtual bool test()=0; + /** Blocks until the async is terminated */ + virtual void wait()=0; + /** Blocks until the async is terminated, or until the timeout is elapsed + * Raises: timeout exception.*/ + virtual void wait(double timeout)=0; + /** Cancel that async */ + //virtual void cancel(); + /** Retrieve the current state of the async */ + e_s4u_async_state_t getState() {return p_state;} private: - double p_remains = 0; + double p_remains = 0; public: - /** Get the remaining amount of work that this Async entails. When it's 0, it's done. */ - double getRemains(); - /** Set the [remaining] amount of work that this Async will entail - * - * It is forbidden to change the amount of work once the Async is started */ - void setRemains(double remains); + /** Get the remaining amount of work that this Async entails. When it's 0, it's done. */ + double getRemains(); + /** Set the [remaining] amount of work that this Async will entail + * + * It is forbidden to change the amount of work once the Async is started */ + void setRemains(double remains); private: - void *p_userData = NULL; + void *p_userData = NULL; public: - /** Put some user data onto the Async */ - void setUserData(void *data) {p_userData=data;} - /** Retrieve the user data of the Async */ - void *getUserData() { return p_userData; } + /** Put some user data onto the Async */ + void setUserData(void *data) {p_userData=data;} + /** Retrieve the user data of the Async */ + void *getUserData() { return p_userData; } }; // class }}; // Namespace simgrid::s4u