]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/actor/ActorImpl.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge network/bandwidth-factor and smpi/bw-factor (and same for latency)
[simgrid.git] / src / kernel / actor / ActorImpl.hpp
index 5ea60486acced2c63cede457c29c16bed7fdd7d2..8f6f640aee76527e4335facc411126fba0e56f03 100644 (file)
@@ -16,9 +16,7 @@
 #include <map>
 #include <memory>
 
-namespace simgrid {
-namespace kernel {
-namespace actor {
+namespace simgrid::kernel::actor {
 class ProcessArg;
 
 /*------------------------- [ ActorIDTrait ] -------------------------*/
@@ -27,15 +25,19 @@ class XBT_PUBLIC ActorIDTrait {
   aid_t pid_         = 0;
   aid_t ppid_        = -1;
 
+  static unsigned long maxpid_;
+
 public:
-  explicit ActorIDTrait(std::string name, aid_t ppid);
+  explicit ActorIDTrait(const std::string& name, aid_t ppid);
   const xbt::string& get_name() const { return name_; }
   const char* get_cname() const { return name_.c_str(); }
   aid_t get_pid() const { return pid_; }
   aid_t get_ppid() const { return ppid_; }
+
+  static unsigned long get_maxpid() { return maxpid_; }
+  // In MC mode, the application sends this pointer to the MC
+  static unsigned long* get_maxpid_addr() { return &maxpid_; }
 };
-XBT_PUBLIC unsigned long get_maxpid();
-XBT_PUBLIC unsigned long* get_maxpid_addr(); // In MC mode, the application sends this pointers to the MC
 
 /*------------------------- [ ActorRestartingTrait ] -------------------------*/
 class XBT_PUBLIC ActorRestartingTrait {
@@ -114,7 +116,7 @@ private:
   std::atomic_int_fast32_t refcount_{0};
 
 public:
-  int get_refcount() const { return refcount_; }
+  int get_refcount() const { return static_cast<int>(refcount_); }
   friend void intrusive_ptr_add_ref(ActorImpl* actor)
   {
     // This whole memory consistency semantic drives me nuts.
@@ -231,8 +233,6 @@ using SynchroList =
 
 XBT_PUBLIC void create_maestro(const std::function<void()>& code);
 
-} // namespace actor
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::actor
 
 #endif