X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/befbbbe1fbb31663a8f91e24ce12df271cf4ae79..d756f639a47486f3266eb84367ec2dfb707cda25:/src/kernel/activity/SynchroRaw.cpp diff --git a/src/kernel/activity/SynchroRaw.cpp b/src/kernel/activity/SynchroRaw.cpp index 509c41d5cd..9326bd2239 100644 --- a/src/kernel/activity/SynchroRaw.cpp +++ b/src/kernel/activity/SynchroRaw.cpp @@ -1,36 +1,51 @@ -/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2019. 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. */ #include "src/kernel/activity/SynchroRaw.hpp" +#include "simgrid/kernel/resource/Action.hpp" +#include "src/kernel/context/Context.hpp" +#include "src/simix/smx_synchro_private.hpp" #include "src/surf/surf_interface.hpp" -#include "src/simix/smx_synchro_private.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_synchro); +namespace simgrid { +namespace kernel { +namespace activity { -simgrid::kernel::activity::RawImpl::~RawImpl() +RawImpl::~RawImpl() { - sleep->unref(); + surf_action_->unref(); } -void simgrid::kernel::activity::RawImpl::suspend() +void RawImpl::suspend() { /* The suspension of raw synchros is delayed to when the process is rescheduled. */ } -void simgrid::kernel::activity::RawImpl::resume() +void RawImpl::resume() { /* I cannot resume raw synchros directly. This is delayed to when the process is rescheduled at * the end of the synchro. */ } -void simgrid::kernel::activity::RawImpl::post() +void RawImpl::post() { XBT_IN("(%p)",this); - if (sleep->getState() == simgrid::surf::Action::State::failed) - state = SIMIX_FAILED; - else if(sleep->getState() == simgrid::surf::Action::State::done) - state = SIMIX_SRC_TIMEOUT; + smx_simcall_t simcall = simcalls_.front(); + simcalls_.pop_front(); - SIMIX_synchro_finish(this); + SIMIX_synchro_stop_waiting(simcall->issuer, simcall); + simcall->issuer->waiting_synchro = nullptr; + + if (surf_action_->get_state() == resource::Action::State::FAILED) { + state_ = SIMIX_FAILED; + simcall->issuer->context_->iwannadie = true; + } else if (surf_action_->get_state() == resource::Action::State::FINISHED) { + state_ = SIMIX_SRC_TIMEOUT; + SIMIX_simcall_answer(simcall); + } XBT_OUT(); } +} // namespace activity +} // namespace kernel +} // namespace simgrid