X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/27fe833c49802fa5fbb1e44dc7b99d119fe3aa4b..01b6b0c026e5fa6a87a45b53a4ce1e4dc580a358:/src/kernel/activity/IoImpl.cpp diff --git a/src/kernel/activity/IoImpl.cpp b/src/kernel/activity/IoImpl.cpp index 7647a18349..a35e92672a 100644 --- a/src/kernel/activity/IoImpl.cpp +++ b/src/kernel/activity/IoImpl.cpp @@ -37,44 +37,36 @@ namespace simgrid { namespace kernel { namespace activity { -IoImpl::IoImpl(const std::string& name, resource::StorageImpl* storage) : ActivityImpl(name), storage_(storage) +IoImpl& IoImpl::set_type(s4u::Io::OpType type) { - this->state_ = SIMIX_RUNNING; + type_ = type; + return *this; +} - XBT_DEBUG("Create io impl %p", this); +IoImpl& IoImpl::set_size(sg_size_t size) +{ + size_ = size; + return *this; } -IoImpl::~IoImpl() +IoImpl& IoImpl::set_storage(resource::StorageImpl* storage) { - if (surf_action_ != nullptr) - surf_action_->unref(); - XBT_DEBUG("Destroy io %p", this); + storage_ = storage; + return *this; } -IoImpl* IoImpl::start(sg_size_t size, s4u::Io::OpType type) +IoImpl* IoImpl::start() { - surf_action_ = storage_->io_start(size, type); + state_ = SIMIX_RUNNING; + surf_action_ = storage_->io_start(size_, type_); surf_action_->set_data(this); XBT_DEBUG("Create IO synchro %p %s", this, get_cname()); - IoImpl::on_start(this); + IoImpl::on_start(*this); return this; } -void IoImpl::cancel() -{ - XBT_VERB("This exec %p is canceled", this); - if (surf_action_ != nullptr) - surf_action_->cancel(); - state_ = SIMIX_CANCELED; -} - -double IoImpl::get_remaining() -{ - return surf_action_ ? surf_action_->get_remains() : 0; -} - void IoImpl::post() { performed_ioops_ = surf_action_->get_cost(); @@ -88,7 +80,7 @@ void IoImpl::post() default: THROW_IMPOSSIBLE; } - on_completion(this); + on_completion(*this); finish(); } @@ -123,8 +115,8 @@ void IoImpl::finish() /************* * Callbacks * *************/ -xbt::signal IoImpl::on_start; -xbt::signal IoImpl::on_completion; +xbt::signal IoImpl::on_start; +xbt::signal IoImpl::on_completion; } // namespace activity } // namespace kernel