That excalated quickly ...
/* If both the sender and the receiver are already there, start the communication */
if (state_ == SIMIX_READY) {
- s4u::Host* sender = src_actor_->host_;
- s4u::Host* receiver = dst_actor_->host_;
+ s4u::Host* sender = src_actor_->get_host();
+ s4u::Host* receiver = dst_actor_->get_host();
surf_action_ = surf_network_model->communicate(sender, receiver, task_size_, rate_);
surf_action_->set_data(this);
if (src_actor_->is_suspended())
XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the "
"communication",
- src_actor_->get_cname(), src_actor_->host_->get_cname());
+ src_actor_->get_cname(), src_actor_->get_host()->get_cname());
else
XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the "
"communication",
- dst_actor_->get_cname(), dst_actor_->host_->get_cname());
+ dst_actor_->get_cname(), dst_actor_->get_host()->get_cname());
surf_action_->suspend();
}
return;
XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", this,
- src_actor_ ? src_actor_->host_->get_cname() : "a finished process", src_buff_,
- dst_actor_ ? dst_actor_->host_->get_cname() : "a finished process", dst_buff_, buff_size);
+ src_actor_ ? src_actor_->get_host()->get_cname() : "a finished process", src_buff_,
+ dst_actor_ ? dst_actor_->get_host()->get_cname() : "a finished process", dst_buff_, buff_size);
/* Copy at most dst_buff_size bytes of the message to receiver's buffer */
if (dst_buff_size_)
mutex->unlock(issuer);
}
- synchro = SIMIX_synchro_wait(issuer->host_, timeout);
+ synchro = SIMIX_synchro_wait(issuer->get_host(), timeout);
synchro->simcalls_.push_front(simcall);
issuer->waiting_synchro = synchro;
cond->sleeping.push_back(*simcall->issuer);
if (this->locked) {
/* FIXME: check if the host is active ? */
/* Somebody using the mutex, use a synchronization to get host failures */
- synchro = SIMIX_synchro_wait(issuer->host_, -1);
+ synchro = SIMIX_synchro_wait(issuer->get_host(), -1);
synchro->simcalls_.push_back(&issuer->simcall);
issuer->waiting_synchro = synchro;
this->sleeping.push_back(*issuer);
/* If the mutex is not owned by the issuer, that's not good */
if (issuer != this->owner)
THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
- this->owner->get_cname(), this->owner->pid_);
+ this->owner->get_cname(), this->owner->get_pid());
if (not this->sleeping.empty()) {
/*process to wake up */
XBT_DEBUG("Wait semaphore %p (timeout:%f)", this, timeout);
if (value_ <= 0) {
- synchro = SIMIX_synchro_wait(issuer->host_, timeout);
+ synchro = SIMIX_synchro_wait(issuer->get_host(), timeout);
synchro->simcalls_.push_front(&issuer->simcall);
issuer->waiting_synchro = synchro;
sleeping_.push_back(*issuer);
THROW_IMPOSSIBLE;
break;
}
- if (not simcall->issuer->host_->is_on()) {
+ if (not simcall->issuer->get_host()->is_on()) {
simcall->issuer->context_->iwannadie = true;
}
simcall_process_sleep__set__result(simcall, result);
simcall->issuer->waiting_synchro = nullptr;
- if (simcall->issuer->suspended_) {
+ if (simcall->issuer->is_suspended()) {
XBT_DEBUG("Wait! This process is suspended and can't wake up now.");
simcall->issuer->suspended_ = false;
simcall_HANDLER_process_suspend(simcall, simcall->issuer);
{
actor_->finished_ = true;
- if (actor_->auto_restart_ && not actor_->host_->is_on()) {
- XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart", actor_->host_->get_cname(),
- actor_->get_cname());
- watched_hosts.insert(actor_->host_->get_name());
+ if (actor_->has_to_auto_restart() && not actor_->get_host()->is_on()) {
+ XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart",
+ actor_->get_host()->get_cname(), actor_->get_cname());
+ watched_hosts.insert(actor_->get_host()->get_name());
}
// Execute the termination callbacks
actor_->comms.clear();
XBT_DEBUG("%s@%s(%ld) should not run anymore", actor_->get_cname(), actor_->iface()->get_host()->get_cname(),
- actor_->pid_);
+ actor_->get_pid());
if (this->cleanup_func_)
this->cleanup_func_(this->actor_);
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_actor_.get()));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()));
- comm_pattern->src_proc = src_proc->pid_;
- comm_pattern->dst_proc = dst_proc->pid_;
+ comm_pattern->src_proc = src_proc->get_pid();
+ comm_pattern->dst_proc = dst_proc->get_pid();
comm_pattern->src_host = MC_smx_actor_get_host_name(src_proc);
comm_pattern->dst_host = MC_smx_actor_get_host_name(dst_proc);
if (comm_pattern->data.size() == 0 && comm->src_buff_ != nullptr) {
{
const smx_actor_t issuer = MC_smx_simcall_get_issuer(request);
simgrid::mc::PatternCommunicationList* initial_pattern =
- xbt_dynar_get_as(initial_communications_pattern, issuer->pid_, simgrid::mc::PatternCommunicationList*);
- xbt_dynar_t incomplete_pattern = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid_, xbt_dynar_t);
+ xbt_dynar_get_as(initial_communications_pattern, issuer->get_pid(), simgrid::mc::PatternCommunicationList*);
+ xbt_dynar_t incomplete_pattern = xbt_dynar_get_as(incomplete_communications_pattern, issuer->get_pid(), xbt_dynar_t);
std::unique_ptr<simgrid::mc::PatternCommunication> pattern =
std::unique_ptr<simgrid::mc::PatternCommunication>(new simgrid::mc::PatternCommunication());
char* remote_name = mc_model_checker->process().read<char*>(
RemotePtr<char*>((uint64_t)(synchro->mbox ? &synchro->mbox->name_ : &synchro->mbox_cpy->name_)));
pattern->rdv = mc_model_checker->process().read_string(RemotePtr<char>(remote_name));
- pattern->src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_actor_.get()))->pid_;
+ pattern->src_proc =
+ mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_actor_.get()))->get_pid();
pattern->src_host = MC_smx_actor_get_host_name(issuer);
#if HAVE_SMPI
&remote_name, remote(comm->mbox ? &simgrid::xbt::string::to_string_data(comm->mbox->name_).data
: &simgrid::xbt::string::to_string_data(comm->mbox_cpy->name_).data));
pattern->rdv = mc_model_checker->process().read_string(RemotePtr<char>(remote_name));
- pattern->dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()))->pid_;
+ pattern->dst_proc =
+ mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()))->get_pid();
pattern->dst_host = MC_smx_actor_get_host_name(issuer);
} else
xbt_die("Unexpected call_type %i", (int) call_type);
- XBT_DEBUG("Insert incomplete comm pattern %p for process %ld", pattern.get(), issuer->pid_);
- xbt_dynar_t dynar = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid_, xbt_dynar_t);
+ XBT_DEBUG("Insert incomplete comm pattern %p for process %ld", pattern.get(), issuer->get_pid());
+ xbt_dynar_t dynar = xbt_dynar_get_as(incomplete_communications_pattern, issuer->get_pid(), xbt_dynar_t);
simgrid::mc::PatternCommunication* pattern2 = pattern.release();
xbt_dynar_push(dynar, &pattern2);
}
state->num);
}
- if (not prev_state->actorStates[issuer->pid_].isDone())
+ if (not prev_state->actorStates[issuer->get_pid()].isDone())
prev_state->addInterleavingSet(issuer);
else
XBT_DEBUG("Process %p is in done set", req->issuer);
const smx_actor_t previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req);
XBT_DEBUG("Simcall %d, process %ld (state %d) and simcall %d, process %ld (state %d) are independent",
- req->call, issuer->pid_, state->num, prev_state->internal_req.call, previous_issuer->pid_,
+ req->call, issuer->get_pid(), state->num, prev_state->internal_req.call, previous_issuer->get_pid(),
prev_state->num);
}
}
#if SIMGRID_HAVE_MC
// If in the MCer, ask the client app since it has all the data
if (mc_model_checker != nullptr) {
- return mc_model_checker->process().actor_is_enabled(actor->pid_);
+ return mc_model_checker->process().actor_is_enabled(actor->get_pid());
}
#endif
if (mutex->owner == nullptr)
return true;
- return mutex->owner->pid_ == req->issuer->pid_;
+ return mutex->owner->get_pid() == req->issuer->get_pid();
}
case SIMCALL_SEM_ACQUIRE: {
value, sizeof(comm_addr));
comm_addr = remote(addr);
}
- checker->complete_comm_pattern(pattern, comm_addr, MC_smx_simcall_get_issuer(req)->pid_, backtracking);
+ checker->complete_comm_pattern(pattern, comm_addr, MC_smx_simcall_get_issuer(req)->get_pid(), backtracking);
}
break;
default:
if (simgrid::mc::processes_time.empty())
return 0;
if (process != nullptr)
- return simgrid::mc::processes_time[process->pid_];
+ return simgrid::mc::processes_time[process->get_pid()];
return -1;
}
void MC_process_clock_add(smx_actor_t process, double amount)
{
- simgrid::mc::processes_time[process->pid_] += amount;
+ simgrid::mc::processes_time[process->get_pid()] += amount;
}
type = "iSend";
char* p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
- if (issuer->host_)
- args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_host_name(issuer),
+ if (issuer->get_host())
+ args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), p, bs);
else
- args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_name(issuer), p, bs);
+ args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_name(issuer), p, bs);
xbt_free(bs);
xbt_free(p);
break;
type = "iRecv";
char* p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
char* bs = buff_size_to_string(size);
- if (issuer->host_)
- args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_host_name(issuer),
+ if (issuer->get_host())
+ args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), p, bs);
else
- args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->pid_, MC_smx_actor_get_name(issuer), p, bs);
+ args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->get_pid(), MC_smx_actor_get_name(issuer), p, bs);
xbt_free(bs);
xbt_free(p);
break;
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_actor_.get()));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_actor_.get()));
args =
- bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->pid_ : 0,
+ bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->get_pid() : 0,
src_proc ? MC_smx_actor_get_host_name(src_proc) : "", src_proc ? MC_smx_actor_get_name(src_proc) : "",
- dst_proc ? dst_proc->pid_ : 0, dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "",
+ dst_proc ? dst_proc->get_pid() : 0, dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "",
dst_proc ? MC_smx_actor_get_name(dst_proc) : "");
}
xbt_free(p);
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_actor_.get()));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_actor_.get()));
- args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->pid_, MC_smx_actor_get_name(src_proc),
- MC_smx_actor_get_host_name(src_proc), dst_proc->pid_, MC_smx_actor_get_name(dst_proc),
+ args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->get_pid(), MC_smx_actor_get_name(src_proc),
+ MC_smx_actor_get_host_name(src_proc), dst_proc->get_pid(), MC_smx_actor_get_name(dst_proc),
MC_smx_actor_get_host_name(dst_proc));
}
xbt_free(p);
? simcall_mutex_lock__get__mutex(req)
: simcall_mutex_trylock__get__mutex(req)
));
- args =
- bprintf("locked = %d, owner = %d, sleeping = n/a", mutex.getBuffer()->locked,
- mutex.getBuffer()->owner != nullptr
- ? (int)mc_model_checker->process().resolveActor(simgrid::mc::remote(mutex.getBuffer()->owner))->pid_
- : -1);
+ args = bprintf(
+ "locked = %d, owner = %d, sleeping = n/a", mutex.getBuffer()->locked,
+ mutex.getBuffer()->owner != nullptr
+ ? (int)mc_model_checker->process().resolveActor(simgrid::mc::remote(mutex.getBuffer()->owner))->get_pid()
+ : -1);
break;
}
std::string str;
if (args != nullptr)
- str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->pid_, MC_smx_actor_get_host_name(issuer),
+ str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), type, args);
else
- str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->pid_, MC_smx_actor_get_host_name(issuer),
+ str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), type);
xbt_free(args);
return str;
switch (req->call) {
case SIMCALL_COMM_ISEND:
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->pid_, MC_smx_actor_get_host_name(issuer));
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
- label = bprintf("[(%ld)] iSend", issuer->pid_);
+ label = bprintf("[(%ld)] iSend", issuer->get_pid());
break;
case SIMCALL_COMM_IRECV:
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->pid_, MC_smx_actor_get_host_name(issuer));
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->pid_);
+ label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->get_pid());
break;
case SIMCALL_COMM_WAIT:
if (value == -1) {
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->pid_, MC_smx_actor_get_host_name(issuer));
+ if (issuer->get_host())
+ label =
+ simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->pid_);
+ label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->get_pid());
} else {
simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_actor_.get()));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()));
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->pid_,
- MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid_ : 0,
- dst_proc ? dst_proc->pid_ : 0);
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->get_pid(),
+ MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->get_pid() : 0,
+ dst_proc ? dst_proc->get_pid() : 0);
else
- label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]", issuer->pid_, src_proc ? src_proc->pid_ : 0,
- dst_proc ? dst_proc->pid_ : 0);
+ label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]", issuer->get_pid(),
+ src_proc ? src_proc->get_pid() : 0, dst_proc ? dst_proc->get_pid() : 0);
}
break;
mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
if (comm->src_actor_.get() == nullptr || comm->dst_actor_.get() == nullptr) {
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->pid_, MC_smx_actor_get_host_name(issuer));
+ if (issuer->get_host())
+ label =
+ simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
- label = bprintf("[(%ld)] Test FALSE", issuer->pid_);
+ label = bprintf("[(%ld)] Test FALSE", issuer->get_pid());
} else {
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->pid_, MC_smx_actor_get_host_name(issuer));
+ if (issuer->get_host())
+ label =
+ simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->pid_);
+ label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->get_pid());
}
break;
}
case SIMCALL_COMM_WAITANY: {
unsigned long comms_size = read_length(
mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(req)));
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %lu]", issuer->pid_,
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %lu]", issuer->get_pid(),
MC_smx_actor_get_host_name(issuer), value + 1, comms_size);
else
- label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %lu]", issuer->pid_, value + 1, comms_size);
+ label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %lu]", issuer->get_pid(), value + 1, comms_size);
break;
}
case SIMCALL_COMM_TESTANY:
if (value == -1) {
- if (issuer->host_)
- label =
- simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->pid_, MC_smx_actor_get_host_name(issuer));
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->get_pid(),
+ MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->pid_);
+ label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->get_pid());
} else {
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->pid_,
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->get_pid(),
MC_smx_actor_get_host_name(issuer), value + 1,
simcall_comm_testany__get__count(req));
else
- label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]", issuer->pid_, value + 1,
+ label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]", issuer->get_pid(), value + 1,
simcall_comm_testany__get__count(req));
}
break;
case SIMCALL_MUTEX_TRYLOCK:
- label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->pid_);
+ label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->get_pid());
break;
case SIMCALL_MUTEX_LOCK:
- label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->pid_);
+ label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->get_pid());
break;
case SIMCALL_MC_RANDOM:
- if (issuer->host_)
- label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->pid_, MC_smx_actor_get_host_name(issuer),
- value);
+ if (issuer->get_host())
+ label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->get_pid(),
+ MC_smx_actor_get_host_name(issuer), value);
else
- label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->pid_, value);
+ label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->get_pid(), value);
break;
default:
THROW_UNIMPLEMENTED;
}
- const char* color = get_color(issuer->pid_ - 1);
+ const char* color = get_color(issuer->get_pid() - 1);
return simgrid::xbt::string_printf(
"label = \"%s\", color = %s, fontcolor = %s", label.c_str(),
color, color);
const char* MC_smx_actor_get_host_name(smx_actor_t actor)
{
if (mc_model_checker == nullptr)
- return actor->host_->get_cname();
+ return actor->get_host()->get_cname();
simgrid::mc::RemoteClient* process = &mc_model_checker->process();
// Read the simgrid::xbt::string in the MCed process:
simgrid::mc::ActorInformation* info = actor_info_cast(actor);
- auto remote_string_address = remote((simgrid::xbt::string_data*)((char*)actor->host_ + offset));
+ auto remote_string_address = remote((simgrid::xbt::string_data*)((char*)actor->get_host() + offset));
simgrid::xbt::string_data remote_string = process->read(remote_string_address);
char hostname[remote_string.len];
process->read_bytes(hostname, remote_string.len + 1, remote(remote_string.data));
static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* state, smx_actor_t actor)
{
/* reset the outgoing transition */
- simgrid::mc::ProcessState* procstate = &state->actorStates[actor->pid_];
+ simgrid::mc::ProcessState* procstate = &state->actorStates[actor->get_pid()];
state->transition.pid = -1;
state->transition.argument = -1;
state->executed_req.call = SIMCALL_NONE;
if (not req)
return nullptr;
- state->transition.pid = actor->pid_;
+ state->transition.pid = actor->get_pid();
state->executed_req = *req;
// Fetch the data of the request and translate it:
state->internal_req = *req;
{
for (auto& actor : mc_model_checker->process().actors()) {
/* Only consider the actors that were marked as interleaving by the checker algorithm */
- if (not state->actorStates[actor.copy.getBuffer()->pid_].isTodo())
+ if (not state->actorStates[actor.copy.getBuffer()->get_pid()].isTodo())
continue;
smx_simcall_t res = MC_state_get_request_for_process(state, actor.copy.getBuffer());
explicit State(unsigned long state_number);
std::size_t interleaveSize() const;
- void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->pid_].consider(); }
+ void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->get_pid()].consider(); }
Transition getTransition() const;
};
}
region.block = ((char*)stack - (char*)heap->heapbase) / BLOCKSIZE + 1;
#if HAVE_SMPI
if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP && process)
- region.process_index = process->pid_ - 1;
+ region.process_index = process->get_pid() - 1;
else
#endif
region.process_index = -1;
std::shared_ptr<simgrid::mc::Snapshot> snapshot = std::make_shared<simgrid::mc::Snapshot>(mc_process, num_state);
for (auto const& p : mc_model_checker->process().actors())
- snapshot->enabled_processes.insert(p.copy.getBuffer()->pid_);
+ snapshot->enabled_processes.insert(p.copy.getBuffer()->get_pid());
snapshot_handle_ignore(snapshot.get());
int MSG_process_self_PID()
{
smx_actor_t self = SIMIX_process_self();
- return self == nullptr ? 0 : self->pid_;
+ return self == nullptr ? 0 : self->get_pid();
}
/** @brief Return the PPID of the current process.
{
if (get_state() != s4u::VirtualMachine::state::RUNNING)
THROWF(vm_error, 0, "Cannot suspend VM %s: it is not running.", piface_->get_cname());
- if (issuer->host_ == piface_)
+ if (issuer->get_host() == piface_)
THROWF(vm_error, 0, "Actor %s cannot suspend the VM %s in which it runs", issuer->get_cname(),
piface_->get_cname());
for (auto& smx_process : process_list_) {
XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", smx_process.get_cname(),
- smx_process.host_->get_cname(), issuer->get_cname());
+ smx_process.get_host()->get_cname(), issuer->get_cname());
issuer->kill(&smx_process);
}
void Actor::set_auto_restart(bool autorestart)
{
simgrid::simix::simcall([this, autorestart]() {
- xbt_assert(autorestart && not pimpl_->auto_restart_); // FIXME: handle all cases
+ xbt_assert(autorestart && not pimpl_->has_to_auto_restart()); // FIXME: handle all cases
pimpl_->set_auto_restart(autorestart);
- simgrid::kernel::actor::ProcessArg* arg = new simgrid::kernel::actor::ProcessArg(pimpl_->host_, pimpl_);
+ simgrid::kernel::actor::ProcessArg* arg = new simgrid::kernel::actor::ProcessArg(pimpl_->get_host(), pimpl_);
XBT_DEBUG("Adding Process %s to the actors_at_boot_ list of Host %s", arg->name.c_str(), arg->host->get_cname());
- pimpl_->host_->pimpl_->actors_at_boot_.emplace_back(arg);
+ pimpl_->get_host()->pimpl_->actors_at_boot_.emplace_back(arg);
});
}
s4u::Host* Actor::get_host()
{
- return this->pimpl_->host_;
+ return this->pimpl_->get_host();
}
void Actor::daemonize()
aid_t Actor::get_pid() const
{
- return this->pimpl_->pid_;
+ return this->pimpl_->get_pid();
}
aid_t Actor::get_ppid() const
{
- return this->pimpl_->ppid_;
+ return this->pimpl_->get_ppid();
}
void Actor::suspend()
bool Actor::is_suspended()
{
- return simgrid::simix::simcall([this] { return pimpl_->suspended_; });
+ return simgrid::simix::simcall([this] { return pimpl_->is_suspended(); });
}
void Actor::set_kill_time(double kill_time)
/** @brief Get the kill time of an actor(or 0 if unset). */
double Actor::get_kill_time()
{
- return SIMIX_timer_get_date(pimpl_->kill_timer);
+ return pimpl_->get_kill_time();
}
void Actor::kill(aid_t pid) // deprecated
aid_t get_pid()
{
- return SIMIX_process_self()->pid_;
+ return SIMIX_process_self()->get_pid();
}
aid_t get_ppid()
{
- return SIMIX_process_self()->ppid_;
+ return SIMIX_process_self()->get_ppid();
}
std::string get_name()
Host* get_host()
{
- return SIMIX_process_self()->host_;
+ return SIMIX_process_self()->get_host();
}
void suspend()
Host* Host::current()
{
- smx_actor_t smx_proc = SIMIX_process_self();
- if (smx_proc == nullptr)
+ smx_actor_t self = SIMIX_process_self();
+ if (self == nullptr)
xbt_die("Cannot call Host::current() from the maestro context");
- return smx_proc->host_;
+ return self->get_host();
}
void Host::turn_on()
sg_host_t sg_host_self()
{
smx_actor_t process = SIMIX_process_self();
- return (process == nullptr) ? nullptr : process->host_;
+ return (process == nullptr) ? nullptr : process->get_host();
}
double sg_host_load(sg_host_t host)
simix_global->mutex.lock();
- simix_global->process_list.erase(process->pid_);
- if (process->host_ && process->host_process_list_hook.is_linked())
- simgrid::xbt::intrusive_erase(process->host_->pimpl_->process_list_, *process);
+ simix_global->process_list.erase(process->get_pid());
+ if (process->get_host() && process->host_process_list_hook.is_linked())
+ simgrid::xbt::intrusive_erase(process->get_host()->pimpl_->process_list_, *process);
if (not process->smx_destroy_list_hook.is_linked()) {
#if SIMGRID_HAVE_MC
xbt_dynar_push_as(simix_global->dead_actors_vector, smx_actor_t, process);
namespace kernel {
namespace actor {
-ActorImpl::ActorImpl(simgrid::xbt::string name, simgrid::s4u::Host* host) : name_(name), host_(host), piface_(this)
+ActorImpl::ActorImpl(simgrid::xbt::string name, s4u::Host* host) : host_(host), name_(name), piface_(this)
{
pid_ = simix_process_maxpid++;
simcall.issuer = this;
} else if (comm != nullptr) {
comms.remove(waiting_synchro);
comm->cancel();
- // Remove first occurrence of &process->simcall:
+ // Remove first occurrence of &actor->simcall:
auto i = boost::range::find(waiting_synchro->simcalls_, &simcall);
if (i != waiting_synchro->simcalls_.end())
waiting_synchro->simcalls_.remove(&simcall);
}
}
-void ActorImpl::kill(smx_actor_t actor)
+void ActorImpl::kill(ActorImpl* actor)
{
if (actor->finished_) {
- XBT_DEBUG("Ignoring request to kill process %s@%s that is already dead", actor->get_cname(),
+ XBT_DEBUG("Ignoring request to kill actor %s@%s that is already dead", actor->get_cname(),
actor->host_->get_cname());
return;
}
{
if (kill_time <= SIMIX_get_clock())
return;
- XBT_DEBUG("Set kill time %f for process %s@%s", kill_time, get_cname(), host_->get_cname());
+ XBT_DEBUG("Set kill time %f for actor %s@%s", kill_time, get_cname(), host_->get_cname());
kill_timer = SIMIX_timer_set(kill_time, [this] {
this->exit();
kill_timer = nullptr;
});
}
+double ActorImpl::get_kill_time()
+{
+ return SIMIX_timer_get_date(kill_timer);
+}
+
static void dying_daemon(int /*exit_status*/, void* data)
{
std::vector<ActorImpl*>* vect = &simix_global->daemons;
}
}
-/** This process will be terminated automatically when the last non-daemon process finishes */
+/** This actor will be terminated automatically when the last non-daemon actor finishes */
void ActorImpl::daemonize()
{
if (not daemon_) {
}
}
-simgrid::s4u::Actor* ActorImpl::restart()
+s4u::Actor* ActorImpl::restart()
{
- XBT_DEBUG("Restarting process %s on %s", get_cname(), host_->get_cname());
+ XBT_DEBUG("Restarting actor %s on %s", get_cname(), host_->get_cname());
- // retrieve the arguments of the old process
- simgrid::kernel::actor::ProcessArg arg = ProcessArg(host_, this);
+ // retrieve the arguments of the old actor
+ ProcessArg arg = ProcessArg(host_, this);
- // kill the old process
+ // kill the old actor
(this == simix_global->maestro_process) ? this->exit() : SIMIX_process_self()->kill(this);
- // start the new process
+ // start the new actor
ActorImplPtr actor =
ActorImpl::create(arg.name, std::move(arg.code), arg.data, arg.host, arg.properties.get(), nullptr);
actor->set_kill_time(arg.kill_time);
return actor->ciface();
}
-smx_activity_t ActorImpl::suspend(ActorImpl* issuer)
+activity::ActivityImplPtr ActorImpl::suspend(ActorImpl* issuer)
{
if (suspended_) {
XBT_DEBUG("Actor '%s' is already suspended", get_cname());
XBT_OUT();
}
-smx_activity_t ActorImpl::join(smx_actor_t actor, double timeout)
+activity::ActivityImplPtr ActorImpl::join(smx_actor_t actor, double timeout)
{
- smx_activity_t res = this->sleep(timeout);
+ activity::ActivityImplPtr res = this->sleep(timeout);
intrusive_ptr_add_ref(res.get());
SIMIX_process_on_exit(actor,
[](int, void* arg) {
res.get());
return res;
}
-smx_activity_t ActorImpl::sleep(double duration)
+
+activity::ActivityImplPtr ActorImpl::sleep(double duration)
{
if (not host_->is_on())
throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
/* cancel the blocking synchro if any */
if (waiting_synchro) {
- simgrid::kernel::activity::ExecImplPtr exec =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(waiting_synchro);
+ activity::ExecImplPtr exec = boost::dynamic_pointer_cast<activity::ExecImpl>(waiting_synchro);
if (exec != nullptr)
exec->cancel();
- simgrid::kernel::activity::CommImplPtr comm =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(waiting_synchro);
+ activity::CommImplPtr comm = boost::dynamic_pointer_cast<activity::CommImpl>(waiting_synchro);
if (comm != nullptr) {
comms.remove(comm);
comm->cancel();
}
- simgrid::kernel::activity::SleepImplPtr sleep =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(waiting_synchro);
+ activity::SleepImplPtr sleep = boost::dynamic_pointer_cast<activity::SleepImpl>(waiting_synchro);
if (sleep != nullptr) {
SIMIX_process_sleep_destroy(waiting_synchro);
if (std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), this) ==
}
}
- simgrid::kernel::activity::RawImplPtr raw =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(waiting_synchro);
+ activity::RawImplPtr raw = boost::dynamic_pointer_cast<activity::RawImpl>(waiting_synchro);
if (raw != nullptr) {
SIMIX_synchro_stop_waiting(this, &simcall);
}
- simgrid::kernel::activity::IoImplPtr io =
- boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(waiting_synchro);
+ activity::IoImplPtr io = boost::dynamic_pointer_cast<activity::IoImpl>(waiting_synchro);
if (io != nullptr) {
io->cancel();
}
waiting_synchro = nullptr;
}
-void ActorImpl::set_host(sg_host_t dest)
+void ActorImpl::set_host(s4u::Host* dest)
{
simgrid::xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
host_ = dest;
dest->pimpl_->process_list_.push_back(*this);
}
-ActorImplPtr ActorImpl::create(std::string name, simgrid::simix::ActorCode code, void* data, simgrid::s4u::Host* host,
- std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_actor)
+ActorImplPtr ActorImpl::create(std::string name, simix::ActorCode code, void* data, s4u::Host* host,
+ std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor)
{
XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname());
return nullptr;
}
- ActorImpl* actor = new simgrid::kernel::actor::ActorImpl(simgrid::xbt::string(name), host);
+ ActorImpl* actor = new ActorImpl(simgrid::xbt::string(name), host);
xbt_assert(code && host != nullptr, "Invalid parameters");
/* actor data */
actor->code = code;
if (parent_actor != nullptr)
- actor->ppid_ = parent_actor->pid_;
+ actor->set_ppid(parent_actor->get_pid());
XBT_VERB("Create context %s", actor->get_cname());
actor->context_ = SIMIX_context_new(std::move(code), &SIMIX_process_cleanup, actor);
for (auto const& kv : *properties)
actor->set_property(kv.first, kv.second);
- /* Add the process to its host's process list */
+ /* Add the actor to its host's actor list */
host->pimpl_->process_list_.push_back(*actor);
XBT_DEBUG("Start context '%s'", actor->get_cname());
- /* Now insert it in the global process list and in the process to run list */
- simix_global->process_list[actor->pid_] = actor;
+ /* Now insert it in the global actor list and in the actor to run list */
+ simix_global->process_list[actor->get_pid()] = actor;
XBT_DEBUG("Inserting [%p] %s(%s) in the to_run list", actor, actor->get_cname(), host->get_cname());
simix_global->actors_to_run.push_back(actor);
intrusive_ptr_add_ref(actor);
/* The on_creation() signal must be delayed until there, where the pid and everything is set */
- simgrid::s4u::Actor::on_creation(actor->iface());
+ s4u::Actor::on_creation(actor->iface());
return ActorImplPtr(actor);
}
-void create_maestro(simgrid::simix::ActorCode code)
+void create_maestro(simix::ActorCode code)
{
- /* Create maestro process and initialize it */
- smx_actor_t maestro = new simgrid::kernel::actor::ActorImpl(simgrid::xbt::string(""), /*host*/ nullptr);
+ /* Create maestro actor and initialize it */
+ ActorImpl* maestro = new ActorImpl(xbt::string(""), /*host*/ nullptr);
if (not code) {
- maestro->context_ = SIMIX_context_new(simgrid::simix::ActorCode(), nullptr, maestro);
+ maestro->context_ = SIMIX_context_new(simix::ActorCode(), nullptr, maestro);
} else {
maestro->context_ = simix_global->context_factory->create_maestro(code, maestro);
}
actor->code = nullptr;
if (parent_process != nullptr)
- actor->ppid_ = parent_process->pid_;
+ actor->set_ppid(parent_process->get_pid());
XBT_VERB("Create context %s", actor->get_cname());
xbt_assert(simix_global != nullptr, "simix is not initialized, please call MSG_init first");
host->pimpl_->process_list_.push_back(*actor);
/* Now insert it in the global process list and in the process to run list */
- simix_global->process_list[actor->pid_] = actor;
+ simix_global->process_list[actor->get_pid()] = actor;
XBT_DEBUG("Inserting [%p] %s(%s) in the to_run list", actor, actor->get_cname(), host->get_cname());
simix_global->actors_to_run.push_back(actor);
intrusive_ptr_add_ref(actor);
{
SMX_EXCEPTION(actor, cat, value, msg);
- if (actor->suspended_)
+ if (actor->is_suspended())
actor->resume();
/* cancel the blocking synchro if any */
namespace kernel {
namespace actor {
-class ActorImpl : public simgrid::surf::PropertyHolder {
+class ActorImpl : public surf::PropertyHolder {
+ s4u::Host* host_ = nullptr; /* the host on which the actor is running */
+ void* userdata_ = nullptr; /* kept for compatibility, it should be replaced with moddata */
+ aid_t pid_ = 0;
+ aid_t ppid_ = -1;
+ bool daemon_ = false; /* Daemon actors are automatically killed when the last non-daemon leaves */
+ bool auto_restart_ = false;
+
public:
- ActorImpl(simgrid::xbt::string name, simgrid::s4u::Host* host);
+ xbt::string name_;
+ ActorImpl(xbt::string name, s4u::Host* host);
~ActorImpl();
- void set_auto_restart(bool autorestart) { auto_restart_ = autorestart; }
+ double get_kill_time();
void set_kill_time(double kill_time);
boost::intrusive::list_member_hook<> host_process_list_hook; /* simgrid::simix::Host::process_list */
boost::intrusive::list_member_hook<> smx_destroy_list_hook; /* simix_global->actors_to_destroy */
boost::intrusive::list_member_hook<> smx_synchro_hook; /* {mutex,cond,sem}->sleeping */
- aid_t pid_ = 0;
- aid_t ppid_ = -1;
- simgrid::xbt::string name_;
- const simgrid::xbt::string& get_name() const { return name_; }
+ const xbt::string& get_name() const { return name_; }
const char* get_cname() const { return name_.c_str(); }
- s4u::Host* host_ = nullptr; /* the host on which the process is running */
- smx_context_t context_ = nullptr; /* the context (uctx/raw/thread) that executes the user function */
+
+ // Accessors to private fields
+ s4u::Host* get_host() { return host_; }
+ void set_host(s4u::Host* dest);
+ void* get_user_data() { return userdata_; }
+ void set_user_data(void* data) { userdata_ = data; }
+ aid_t get_pid() const { return pid_; }
+ aid_t get_ppid() const { return ppid_; }
+ void set_ppid(aid_t ppid) { ppid_ = ppid; }
+ bool is_daemon() { return daemon_; } /** Whether this actor has been daemonized */
+ bool has_to_auto_restart() { return auto_restart_; }
+ void set_auto_restart(bool autorestart) { auto_restart_ = autorestart; }
+
+ context::Context* context_ = nullptr; /* the context (uctx/raw/thread) that executes the user function */
std::exception_ptr exception_;
- bool finished_ = false;
- bool blocked_ = false;
- bool suspended_ = false;
- bool auto_restart_ = false;
+ bool finished_ = false;
+ bool blocked_ = false; /* FIXME this field is never set to true. Either use it or remove it. */
+ bool suspended_ = false;
- smx_activity_t waiting_synchro = nullptr; /* the current blocking synchro if any */
- std::list<smx_activity_t> comms; /* the current non-blocking communication synchros */
+ activity::ActivityImplPtr waiting_synchro = nullptr; /* the current blocking synchro if any */
+ std::list<activity::ActivityImplPtr> comms; /* the current non-blocking communication synchros */
s_smx_simcall simcall;
std::vector<s_smx_process_exit_fun_t> on_exit; /* list of functions executed when the process dies */
smx_timer_t kill_timer = nullptr;
private:
- void* userdata_ = nullptr; /* kept for compatibility, it should be replaced with moddata */
/* Refcounting */
std::atomic_int_fast32_t refcount_{0};
/* S4U/implem interfaces */
private:
- simgrid::s4u::Actor piface_; // Our interface is part of ourselves
+ s4u::Actor piface_; // Our interface is part of ourselves
public:
- simgrid::s4u::ActorPtr iface() { return s4u::ActorPtr(&piface_); }
- simgrid::s4u::Actor* ciface() { return &piface_; }
+ s4u::ActorPtr iface() { return s4u::ActorPtr(&piface_); }
+ s4u::Actor* ciface() { return &piface_; }
- /* Daemon actors are automatically killed when the last non-daemon leaves */
-private:
- bool daemon_ = false;
-public:
static ActorImplPtr create(std::string name, simix::ActorCode code, void* data, s4u::Host* host,
- std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_actor);
+ std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor);
void exit();
- void kill(smx_actor_t actor);
+ void kill(ActorImpl* actor);
void kill_all();
void yield();
void daemonize();
- bool is_daemon() { return daemon_; } /** Whether this actor has been daemonized */
bool is_suspended() { return suspended_; }
- simgrid::s4u::Actor* restart();
- smx_activity_t suspend(ActorImpl* issuer);
+ s4u::Actor* restart();
+ activity::ActivityImplPtr suspend(ActorImpl* issuer);
void resume();
- smx_activity_t join(smx_actor_t actor, double timeout);
- smx_activity_t sleep(double duration);
- void set_user_data(void* data) { userdata_ = data; }
- void* get_user_data() { return userdata_; }
+ activity::ActivityImplPtr join(ActorImpl* actor, double timeout);
+ activity::ActivityImplPtr sleep(double duration);
/** Ask the actor to throw an exception right away */
void throw_exception(std::exception_ptr e);
- void set_host(sg_host_t dest);
};
class ProcessArg {
, code(std::move(actor->code))
, data(actor->get_user_data())
, host(host)
- , kill_time(SIMIX_timer_get_date(actor->kill_timer))
- , auto_restart(actor->auto_restart_)
+ , kill_time(actor->get_kill_time())
+ , auto_restart(actor->has_to_auto_restart())
, daemon_(actor->is_daemon())
{
properties.reset(actor->get_properties(), [](decltype(actor->get_properties())) {});
SynchroList;
XBT_PUBLIC void create_maestro(std::function<void()> code);
-}
+} // namespace actor
} // namespace kernel
} // namespace simgrid
-typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
-
XBT_PRIVATE void SIMIX_process_cleanup(smx_actor_t arg);
extern void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr actor);
break;
case SIMCALL_NONE:
THROWF(arg_error, 0, "Asked to do the noop syscall on %s@%s", simcall->issuer->get_cname(),
- sg_host_get_name(simcall->issuer->host_));
+ sg_host_get_name(simcall->issuer->get_host()));
break;
default:
THROW_IMPOSSIBLE;
fd.write(' break;\n')
fd.write(' case SIMCALL_NONE:\n')
fd.write(' THROWF(arg_error, 0, "Asked to do the noop syscall on %s@%s", simcall->issuer->get_cname(),\n')
- fd.write(' sg_host_get_name(simcall->issuer->host_));\n')
+ fd.write(' sg_host_get_name(simcall->issuer->get_host()));\n')
fd.write(' break;\n')
fd.write(' default:\n')
fd.write(' THROW_IMPOSSIBLE;\n')
if (boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro) != nullptr)
synchro_description = "I/O";
- XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid_,
- process->get_cname(), process->host_->get_cname(), synchro_description, process->waiting_synchro.get(),
- process->waiting_synchro->get_cname(), (int)process->waiting_synchro->state_);
+ XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->get_pid(),
+ process->get_cname(), process->get_host()->get_cname(), synchro_description,
+ process->waiting_synchro.get(), process->waiting_synchro->get_cname(),
+ (int)process->waiting_synchro->state_);
}
else {
- XBT_INFO("Process %ld (%s@%s)", process->pid_, process->get_cname(), process->host_->get_cname());
+ XBT_INFO("Process %ld (%s@%s)", process->get_pid(), process->get_cname(), process->get_host()->get_cname());
}
}
}
break;
case SIMIX_FAILED:
- XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->host_->get_cname());
+ XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", simcall->issuer->get_host()->get_cname());
simcall->issuer->context_->iwannadie = true;
simcall->issuer->exception_ =
std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
simcall_execution_wait__set__result(simcall, exec->state_);
/* Fail the process if the host is down */
- if (simcall->issuer->host_->is_on())
+ if (simcall->issuer->get_host()->is_on())
SIMIX_simcall_answer(simcall);
else
simcall->issuer->context_->iwannadie = true;
}
simcall->issuer->waiting_synchro = nullptr;
- if (simcall->issuer->host_->is_on())
+ if (simcall->issuer->get_host()->is_on())
SIMIX_simcall_answer(simcall);
else
simcall->issuer->context_->iwannadie = true;
if (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING) {
SIMIX_comm_finish(synchro);
} else { /* we need a sleep action (even when there is no timeout) to be notified of host failures */
- simgrid::kernel::resource::Action* sleep = simcall->issuer->host_->pimpl_cpu->sleep(timeout);
+ simgrid::kernel::resource::Action* sleep = simcall->issuer->get_host()->pimpl_cpu->sleep(timeout);
sleep->set_data(synchro.get());
simgrid::kernel::activity::CommImplPtr comm =
/* Check out for errors */
- if (not simcall->issuer->host_->is_on()) {
+ if (not simcall->issuer->get_host()->is_on()) {
simcall->issuer->context_->iwannadie = true;
simcall->issuer->exception_ =
std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
case SIMIX_LINK_FAILURE:
XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) "
"detached:%d",
- synchro.get(), comm->src_actor_ ? comm->src_actor_->host_->get_cname() : nullptr,
- comm->dst_actor_ ? comm->dst_actor_->host_->get_cname() : nullptr, simcall->issuer->get_cname(),
- simcall->issuer, comm->detached);
+ synchro.get(), comm->src_actor_ ? comm->src_actor_->get_host()->get_cname() : nullptr,
+ comm->dst_actor_ ? comm->dst_actor_->get_host()->get_cname() : nullptr,
+ simcall->issuer->get_cname(), simcall->issuer, comm->detached);
if (comm->src_actor_ == simcall->issuer) {
XBT_DEBUG("I'm source");
} else if (comm->dst_actor_ == simcall->issuer) {
}
}
- if (simcall->issuer->host_->is_on())
+ if (simcall->issuer->get_host()->is_on())
SIMIX_simcall_answer(simcall);
else
simcall->issuer->context_->iwannadie = true;
int intra_comm_size = 0;
int min_index = INT_MAX; // the minimum index will be the leader
for (auto& actor : process_list) {
- int index = actor.pid_;
+ int index = actor.get_pid();
if (this->group()->rank(actor.iface()) != MPI_UNDEFINED) { // Is this process in the current group?
intra_comm_size++;
if (index < min_index)
simgrid::surf::HostModel *surf_host_model = nullptr;
/*************
- * Callbacks *
+ * Callbacks *t
*************/
namespace simgrid {
if (arg->kill_time >= 0)
actor->set_kill_time(arg->kill_time);
if (arg->auto_restart)
- actor->auto_restart_ = arg->auto_restart;
+ actor->set_auto_restart(arg->auto_restart);
if (arg->daemon_)
actor->daemonize();
}
if (not process_list_.empty()) {
for (auto& actor : process_list_) {
XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
- actor.host_->get_cname(), SIMIX_process_self()->get_cname());
+ actor.get_host()->get_cname(), SIMIX_process_self()->get_cname());
SIMIX_process_self()->kill(&actor);
}
}