+ on_completion(*this);
+
+ /* Answer all simcalls associated with the synchro */
+ finish();
+}
+
+void IoImpl::finish()
+{
+ while (not simcalls_.empty()) {
+ smx_simcall_t simcall = simcalls_.front();
+ simcalls_.pop_front();
+ switch (state_) {
+ case State::DONE:
+ /* do nothing, synchro done */
+ break;
+ case State::FAILED:
+ simcall->issuer_->context_->iwannadie = true;
+ simcall->issuer_->exception_ =
+ std::make_exception_ptr(StorageFailureException(XBT_THROW_POINT, "Storage failed"));
+ break;
+ case State::CANCELED:
+ simcall->issuer_->exception_ = std::make_exception_ptr(CancelException(XBT_THROW_POINT, "I/O Canceled"));
+ break;
+ default:
+ xbt_die("Internal error in IoImpl::finish(): unexpected synchro state %d", static_cast<int>(state_));
+ }