Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] don't mix public/private data members
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 7 Jan 2020 11:11:09 +0000 (12:11 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 7 Jan 2020 11:11:09 +0000 (12:11 +0100)
src/kernel/activity/IoImpl.cpp
src/kernel/activity/IoImpl.hpp

index cc58290..be073a7 100644 (file)
@@ -42,11 +42,10 @@ void simcall_HANDLER_io_wait(smx_simcall_t simcall, simgrid::kernel::activity::I
   else {
     /* we need a sleep action (even when there is no timeout) to be notified of host failures */
     if (synchro->get_disk() != nullptr)
-      synchro->timeout_detector_ = synchro->get_disk()->get_host()->pimpl_cpu->sleep(timeout);
+      synchro->set_timeout_detector(synchro->get_disk()->get_host()->pimpl_cpu->sleep(timeout));
     else
-      synchro->timeout_detector_ =
-          simgrid::s4u::Host::by_name(synchro->get_storage()->get_host())->pimpl_cpu->sleep(timeout);
-    synchro->timeout_detector_->set_activity(synchro);
+      synchro->set_timeout_detector(
+          simgrid::s4u::Host::by_name(synchro->get_storage()->get_host())->pimpl_cpu->sleep(timeout));
   }
 }
 
index 39305e1..897cfb5 100644 (file)
@@ -20,6 +20,7 @@ class XBT_PUBLIC IoImpl : public ActivityImpl_T<IoImpl> {
   sg_size_t size_                 = 0;
   s4u::Io::OpType type_           = s4u::Io::OpType::READ;
   sg_size_t performed_ioops_      = 0;
+  resource::Action* timeout_detector_ = nullptr;
 
 public:
   IoImpl& set_size(sg_size_t size);
@@ -27,6 +28,12 @@ public:
   IoImpl& set_storage(resource::StorageImpl* storage);
   IoImpl& set_disk(resource::DiskImpl* disk);
 
+  void set_timeout_detector(resource::Action* action)
+  {
+    timeout_detector_ = action;
+    timeout_detector_->set_activity(this);
+  }
+
   sg_size_t get_performed_ioops() { return performed_ioops_; }
   resource::DiskImpl* get_disk() { return disk_; }
   resource::StorageImpl* get_storage() { return storage_; }
@@ -35,7 +42,6 @@ public:
   void post() override;
   void finish() override;
 
-  resource::Action* timeout_detector_ = nullptr;
   static xbt::signal<void(IoImpl const&)> on_start;
   static xbt::signal<void(IoImpl const&)> on_completion;
 };