if (MC_is_active() || MC_record_replay_is_active()) {
int idx = issuer->simcall_.mc_value_;
if (idx == 0) {
- state_ = simgrid::kernel::activity::State::DONE;
+ state_ = State::DONE;
} else {
/* If we reached this point, the wait simcall must have a timeout */
/* Otherwise it shouldn't be enabled and executed by the MC */
if (timeout < 0.0)
THROW_IMPOSSIBLE;
- state_ = simgrid::kernel::activity::State::TIMEOUT;
+ state_ = State::TIMEOUT;
}
finish();
return;
}
/* If the synchro is already finished then perform the error handling */
- if (state_ != simgrid::kernel::activity::State::RUNNING)
+ if (state_ != State::RUNNING)
finish();
else if (timeout == 0.) {
// still running and timeout == 0 ? We need to report a timeout
- state_ = simgrid::kernel::activity::State::TIMEOUT;
+ state_ = State::TIMEOUT;
finish();
} else {
/* we need a sleep action (even when the timeout is infinite) to be notified of host failures */
}
// boost::intrusive_ptr<Activity> support:
-void intrusive_ptr_add_ref(simgrid::kernel::activity::ActivityImpl* activity)
+void intrusive_ptr_add_ref(ActivityImpl* activity)
{
activity->refcount_.fetch_add(1, std::memory_order_relaxed);
}
-void intrusive_ptr_release(simgrid::kernel::activity::ActivityImpl* activity)
+void intrusive_ptr_release(ActivityImpl* activity)
{
if (activity->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
std::atomic_thread_fence(std::memory_order_acquire);
auto* comm = comms[idx];
comm->simcalls_.push_back(&issuer->simcall_);
simcall_comm_waitany__set__result(&issuer->simcall_, idx);
- comm->state_ = simgrid::kernel::activity::State::DONE;
+ comm->state_ = State::DONE;
comm->finish();
return;
}
if (timeout < 0.0) {
issuer->simcall_.timeout_cb_ = nullptr;
} else {
- issuer->simcall_.timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, comms]() {
+ issuer->simcall_.timeout_cb_ = simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, comms]() {
// FIXME: Vector `comms' is copied here. Use a reference once its lifetime is extended (i.e. when the simcall is
// modernized).
issuer->simcall_.timeout_cb_ = nullptr;
comm->simcalls_.push_back(&issuer->simcall_);
/* see if the synchro is already finished */
- if (comm->state_ != simgrid::kernel::activity::State::WAITING &&
- comm->state_ != simgrid::kernel::activity::State::RUNNING) {
+ if (comm->state_ != State::WAITING && comm->state_ != State::RUNNING) {
comm->finish();
break;
}
if (simcall->call_ == simix::Simcall::NONE) // FIXME: maybe a better way to handle this case
continue; // if actor handling comm is killed
if (simcall->call_ == simix::Simcall::COMM_WAITANY) {
- simgrid::kernel::activity::CommImpl** comms = simcall_comm_waitany__get__comms(simcall);
- size_t count = simcall_comm_waitany__get__count(simcall);
+ CommImpl** comms = simcall_comm_waitany__get__comms(simcall);
+ size_t count = simcall_comm_waitany__get__count(simcall);
for (size_t i = 0; i < count; i++)
comms[i]->unregister_simcall(simcall);
if (simcall->timeout_cb_) {
switch (state_) {
case State::SRC_TIMEOUT:
simcall->issuer_->exception_ = std::make_exception_ptr(
- simgrid::TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the sender"));
+ TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the sender"));
break;
case State::DST_TIMEOUT:
simcall->issuer_->exception_ = std::make_exception_ptr(
- simgrid::TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the receiver"));
+ TimeoutException(XBT_THROW_POINT, "Communication timeouted because of the receiver"));
break;
case State::SRC_HOST_FAILURE:
simcall->issuer_->context_->set_wannadie();
else
simcall->issuer_->exception_ =
- std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
+ std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
break;
case State::DST_HOST_FAILURE:
simcall->issuer_->context_->set_wannadie();
else
simcall->issuer_->exception_ =
- std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
+ std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
break;
case State::LINK_FAILURE:
XBT_DEBUG("I'm neither source nor dest");
}
simcall->issuer_->throw_exception(
- std::make_exception_ptr(simgrid::NetworkFailureException(XBT_THROW_POINT, "Link failure")));
+ std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Link failure")));
break;
case State::CANCELED:
if (simcall->issuer_ == dst_actor_)
- simcall->issuer_->exception_ = std::make_exception_ptr(
- simgrid::CancelException(XBT_THROW_POINT, "Communication canceled by the sender"));
+ simcall->issuer_->exception_ =
+ std::make_exception_ptr(CancelException(XBT_THROW_POINT, "Communication canceled by the sender"));
else
- simcall->issuer_->exception_ = std::make_exception_ptr(
- simgrid::CancelException(XBT_THROW_POINT, "Communication canceled by the receiver"));
+ simcall->issuer_->exception_ =
+ std::make_exception_ptr(CancelException(XBT_THROW_POINT, "Communication canceled by the receiver"));
break;
default:
// In order to modify the exception we have to rethrow it:
try {
std::rethrow_exception(simcall->issuer_->exception_);
- } catch (simgrid::Exception& e) {
+ } catch (Exception& e) {
e.set_value(rank);
}
}
}
// boost::intrusive_ptr<ConditionVariableImpl> support:
-void intrusive_ptr_add_ref(simgrid::kernel::activity::ConditionVariableImpl* cond)
+void intrusive_ptr_add_ref(ConditionVariableImpl* cond)
{
cond->refcount_.fetch_add(1, std::memory_order_relaxed);
}
-void intrusive_ptr_release(simgrid::kernel::activity::ConditionVariableImpl* cond)
+void intrusive_ptr_release(ConditionVariableImpl* cond)
{
if (cond->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
std::atomic_thread_fence(std::memory_order_acquire);
case State::FAILED:
simcall->issuer_->context_->set_wannadie();
if (simcall->issuer_->get_host()->is_on())
- simcall->issuer_->exception_ =
- std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
+ simcall->issuer_->exception_ = std::make_exception_ptr(HostFailureException(XBT_THROW_POINT, "Host failed"));
/* else, the actor will be killed with no possibility to survive */
break;
case State::CANCELED:
- simcall->issuer_->exception_ =
- std::make_exception_ptr(simgrid::CancelException(XBT_THROW_POINT, "Execution Canceled"));
+ simcall->issuer_->exception_ = std::make_exception_ptr(CancelException(XBT_THROW_POINT, "Execution Canceled"));
break;
case State::TIMEOUT:
- simcall->issuer_->exception_ = std::make_exception_ptr(simgrid::TimeoutException(XBT_THROW_POINT, "Timeouted"));
+ simcall->issuer_->exception_ = std::make_exception_ptr(TimeoutException(XBT_THROW_POINT, "Timeouted"));
break;
default:
if (timeout < 0.0) {
issuer->simcall_.timeout_cb_ = nullptr;
} else {
- issuer->simcall_.timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, &execs]() {
+ issuer->simcall_.timeout_cb_ = simix::Timer::set(SIMIX_get_clock() + timeout, [issuer, &execs]() {
issuer->simcall_.timeout_cb_ = nullptr;
for (auto* exec : execs)
exec->unregister_simcall(&issuer->simcall_);
exec->simcalls_.push_back(&issuer->simcall_);
/* see if the synchro is already finished */
- if (exec->state_ != simgrid::kernel::activity::State::WAITING &&
- exec->state_ != simgrid::kernel::activity::State::RUNNING) {
+ if (exec->state_ != State::WAITING && exec->state_ != State::RUNNING) {
exec->finish();
break;
}
simcall->issuer_->exception_ = std::make_exception_ptr(CancelException(XBT_THROW_POINT, "I/O Canceled"));
break;
case State::TIMEOUT:
- simcall->issuer_->exception_ = std::make_exception_ptr(simgrid::TimeoutException(XBT_THROW_POINT, "Timeouted"));
+ simcall->issuer_->exception_ = std::make_exception_ptr(TimeoutException(XBT_THROW_POINT, "Timeouted"));
break;
default:
xbt_assert(state_ == State::DONE, "Internal error in IoImpl::finish(): unexpected synchro state %s",
#include "simgrid/modelchecker.h"
#include "src/mc/mc_safety.hpp"
#define MC_CHECK_NO_DPOR() \
- xbt_assert(not MC_is_active() || simgrid::mc::reduction_mode != simgrid::mc::ReductionMode::dpor, \
+ xbt_assert(not MC_is_active() || mc::reduction_mode != mc::ReductionMode::dpor, \
"Mutex is currently not supported with DPOR, use --cfg=model-check/reduction:none")
#else
#define MC_CHECK_NO_DPOR() (void)0