Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / include / simgrid / s4u / Actor.hpp
index 8299eb1..2a77e8e 100644 (file)
@@ -19,6 +19,7 @@
 #include <xbt/Extendable.hpp>
 #include <xbt/functional.hpp>
 #include <xbt/string.hpp>
+#include <xbt/signal.hpp>
 
 #include <simgrid/chrono.hpp>
 #include <simgrid/s4u/forward.hpp>
@@ -155,13 +156,18 @@ public:
   Actor& operator=(Actor const&) = delete;
 
   // ***** Reference count *****
-  friend void intrusive_ptr_add_ref(Actor * actor);
-  friend void intrusive_ptr_release(Actor * actor);
+  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(Actor * actor);
+  friend XBT_PUBLIC(void) intrusive_ptr_release(Actor * actor);
 
   // ***** Actor creation *****
   /** Retrieve a reference to myself */
   static ActorPtr self();
 
+  /** Signal to others that a new actor has been created **/
+  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> onCreation;
+  /** Signal indicating that the given actor is about to disappear */
+  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> onDestruction;
+
   /** Create an actor using a function
    *
    *  If the actor is restarted, the actor has a fresh copy of the function.
@@ -198,6 +204,9 @@ public:
   /** This actor will be automatically terminated when the last non-daemon actor finishes **/
   void daemonize();
 
+  /** Returns whether or not this actor has been daemonized or not **/
+  bool isDaemon();
+
   /** Retrieves the name of that actor as a C++ string */
   const simgrid::xbt::string& getName() const;
   /** Retrieves the name of that actor as a C string */
@@ -275,9 +284,6 @@ public:
   const char* getProperty(const char* key);
   void setProperty(const char* key, const char* value);
   Actor* restart();
-
-  ExecPtr exec_init(double flops_amounts);
-  ExecPtr exec_async(double flops_amounts);
 };
 
 /** @ingroup s4u_api
@@ -319,6 +325,9 @@ XBT_PUBLIC(void) parallel_execute(int host_nb, sg_host_t* host_list, double* flo
 XBT_PUBLIC(void)
 parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double timeout);
 
+XBT_PUBLIC(ExecPtr) exec_init(double flops_amounts);
+XBT_PUBLIC(ExecPtr) exec_async(double flops_amounts);
+
 /** Block the actor until it gets a message from the given mailbox.
  *
  * See \ref Comm for the full communication API (including non blocking communications).