Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / s4u / s4u_Disk.cpp
index fa64f72..c97f72b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2019-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2019-2023. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -17,7 +17,7 @@ namespace s4u {
 
 xbt::signal<void(Disk&)> Disk::on_creation;
 xbt::signal<void(Disk const&)> Disk::on_destruction;
-xbt::signal<void(Disk const&)> Disk::on_state_change;
+xbt::signal<void(Disk const&)> Disk::on_onoff;
 
 const std::string& Disk::get_name() const
 {
@@ -31,13 +31,13 @@ const char* Disk::get_cname() const
 
 Disk* Disk::set_read_bandwidth(double read_bw)
 {
-  kernel::actor::simcall_answered([this, read_bw] { pimpl_->set_read_bandwidth(read_bw); });
+  kernel::actor::simcall_object_access(pimpl_, [this, read_bw] { pimpl_->set_read_bandwidth(read_bw); });
   return this;
 }
 
 Disk* Disk::set_write_bandwidth(double write_bw)
 {
-  kernel::actor::simcall_answered([this, write_bw] { pimpl_->set_write_bandwidth(write_bw); });
+  kernel::actor::simcall_object_access(pimpl_, [this, write_bw] { pimpl_->set_write_bandwidth(write_bw); });
   return this;
 }
 
@@ -48,7 +48,7 @@ double Disk::get_read_bandwidth() const
 
 Disk* Disk::set_readwrite_bandwidth(double bw)
 {
-  kernel::actor::simcall_answered([this, bw] { pimpl_->set_readwrite_bandwidth(bw); });
+  kernel::actor::simcall_object_access(pimpl_, [this, bw] { pimpl_->set_readwrite_bandwidth(bw); });
   return this;
 }
 
@@ -80,34 +80,46 @@ const char* Disk::get_property(const std::string& key) const
 
 Disk* Disk::set_property(const std::string& key, const std::string& value)
 {
-  kernel::actor::simcall_answered([this, &key, &value] { this->pimpl_->set_property(key, value); });
+  kernel::actor::simcall_object_access(pimpl_, [this, &key, &value] { this->pimpl_->set_property(key, value); });
   return this;
 }
 
 Disk* Disk::set_properties(const std::unordered_map<std::string, std::string>& properties)
 {
-  kernel::actor::simcall_answered([this, properties] { this->pimpl_->set_properties(properties); });
+  kernel::actor::simcall_object_access(pimpl_, [this, properties] { this->pimpl_->set_properties(properties); });
   return this;
 }
 
 Disk* Disk::set_state_profile(kernel::profile::Profile* profile)
 {
   xbt_assert(not pimpl_->is_sealed(), "Cannot set a state profile once the Disk is sealed");
-  kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_state_profile(profile); });
+  kernel::actor::simcall_object_access(pimpl_, [this, profile]() { this->pimpl_->set_state_profile(profile); });
   return this;
 }
 
 Disk* Disk::set_read_bandwidth_profile(kernel::profile::Profile* profile)
 {
   xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Disk is sealed");
-  kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_read_bandwidth_profile(profile); });
+  kernel::actor::simcall_object_access(pimpl_,
+                                       [this, profile]() { this->pimpl_->set_read_bandwidth_profile(profile); });
   return this;
 }
 
 Disk* Disk::set_write_bandwidth_profile(kernel::profile::Profile* profile)
 {
   xbt_assert(not pimpl_->is_sealed(), "Cannot set a bandwidth profile once the Disk is sealed");
-  kernel::actor::simcall_answered([this, profile]() { this->pimpl_->set_write_bandwidth_profile(profile); });
+  kernel::actor::simcall_object_access(pimpl_,
+                                       [this, profile]() { this->pimpl_->set_write_bandwidth_profile(profile); });
+  return this;
+}
+int Disk::get_concurrency_limit() const
+{
+  return pimpl_->get_concurrency_limit();
+}
+
+Disk* Disk::set_concurrency_limit(int limit)
+{
+  kernel::actor::simcall_object_access(pimpl_, [this, limit] { pimpl_->set_concurrency_limit(limit); });
   return this;
 }
 
@@ -118,45 +130,45 @@ IoPtr Disk::io_init(sg_size_t size, Io::OpType type) const
 
 IoPtr Disk::read_async(sg_size_t size) const
 {
-  return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start();
+  return IoPtr(io_init(size, Io::OpType::READ))->start();
 }
 
 sg_size_t Disk::read(sg_size_t size) const
 {
-  return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start()->wait()->get_performed_ioops();
+  return IoPtr(io_init(size, Io::OpType::READ))->start()->wait()->get_performed_ioops();
 }
 
 sg_size_t Disk::read(sg_size_t size, double priority) const
 {
   return IoPtr(io_init(size, Io::OpType::READ))
       ->set_priority(priority)
-      ->vetoable_start()
+      ->start()
       ->wait()
       ->get_performed_ioops();
 }
 
 IoPtr Disk::write_async(sg_size_t size) const
 {
-  return IoPtr(io_init(size, Io::OpType::WRITE)->vetoable_start());
+  return IoPtr(io_init(size, Io::OpType::WRITE)->start());
 }
 
 sg_size_t Disk::write(sg_size_t size) const
 {
-  return IoPtr(io_init(size, Io::OpType::WRITE))->vetoable_start()->wait()->get_performed_ioops();
+  return IoPtr(io_init(size, Io::OpType::WRITE))->start()->wait()->get_performed_ioops();
 }
 
 sg_size_t Disk::write(sg_size_t size, double priority) const
 {
   return IoPtr(io_init(size, Io::OpType::WRITE))
       ->set_priority(priority)
-      ->vetoable_start()
+      ->start()
       ->wait()
       ->get_performed_ioops();
 }
 
 Disk* Disk::set_sharing_policy(Disk::Operation op, Disk::SharingPolicy policy, const NonLinearResourceCb& cb)
 {
-  kernel::actor::simcall_answered([this, op, policy, &cb] { pimpl_->set_sharing_policy(op, policy, cb); });
+  kernel::actor::simcall_object_access(pimpl_, [this, op, policy, &cb] { pimpl_->set_sharing_policy(op, policy, cb); });
   return this;
 }
 
@@ -167,7 +179,7 @@ Disk::SharingPolicy Disk::get_sharing_policy(Operation op) const
 
 Disk* Disk::set_factor_cb(const std::function<IoFactorCb>& cb)
 {
-  kernel::actor::simcall_answered([this, &cb] { pimpl_->set_factor_cb(cb); });
+  kernel::actor::simcall_object_access(pimpl_, [this, &cb] { pimpl_->set_factor_cb(cb); });
   return this;
 }