}
}
-/** Whether this process is daemonized */
-bool ActorImpl::isDaemon()
+void ActorImpl::resume()
{
- return daemon;
+ XBT_IN("process = %p", this);
+
+ if (context->iwannadie) {
+ XBT_VERB("Ignoring request to suspend a process that is currently dying.");
+ return;
+ }
+
+ if (not suspended)
+ return;
+ suspended = 0;
+
+ /* resume the synchronization that was blocking the resumed process. */
+ if (waiting_synchro)
+ waiting_synchro->resume();
+
+ XBT_OUT();
}
void create_maestro(std::function<void()> code)
xbt_dict_t properties, smx_actor_t parent_process)
{
- XBT_DEBUG("Start process %s on host '%s'", name, host->cname());
+ XBT_DEBUG("Start process %s on host '%s'", name, host->getCname());
if (host->isOff()) {
- XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->cname());
+ XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, host->getCname());
return nullptr;
}
#if HAVE_SMPI
if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
if (parent_process->pid != 0) {
- SIMIX_segment_index_set(process, parent_process->segment_index);
+ process->segment_index = parent_process->segment_index;
} else {
- SIMIX_segment_index_set(process, process->pid - 1);
+ process->segment_index = process->pid - 1;
}
}
#endif
/* Now insert it in the global process list and in the process to run list */
simix_global->process_list[process->pid] = process;
- XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname());
+ XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->getCname());
xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process);
intrusive_ptr_add_ref(process);
#if HAVE_SMPI
if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
if (parent_process->pid != 0) {
- SIMIX_segment_index_set(process, parent_process->segment_index);
+ process->segment_index = parent_process->segment_index;
} else {
- SIMIX_segment_index_set(process, process->pid - 1);
+ process->segment_index = process->pid - 1;
}
}
#endif
/* Now insert it in the global process list and in the process to run list */
simix_global->process_list[process->pid] = process;
- XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->cname());
+ XBT_DEBUG("Inserting %s(%s) in the to_run list", process->cname(), host->getCname());
xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process);
/* Tracing the process creation */
*/
void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
- XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->cname());
+ XBT_DEBUG("Killing process %s@%s", process->cname(), process->host->getCname());
process->context->iwannadie = 1;
process->blocked = 0;
SMX_EXCEPTION(process, cat, value, msg);
if (process->suspended)
- SIMIX_process_resume(process);
+ process->resume();
/* cancel the blocking synchro if any */
if (process->waiting_synchro) {
xbt_swag_insert(process, dest->extension<simgrid::simix::Host>()->process_list);
}
-
void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process)
{
smx_activity_t sync_suspend = SIMIX_process_suspend(process, simcall->issuer);
}
}
-void SIMIX_process_resume(smx_actor_t process)
-{
- XBT_IN("process = %p", process);
-
- if (process->context->iwannadie) {
- XBT_VERB("Ignoring request to suspend a process that is currently dying.");
- return;
- }
-
- if (not process->suspended)
- return;
- process->suspended = 0;
-
- /* resume the synchronization that was blocking the resumed process. */
- if (process->waiting_synchro)
- process->waiting_synchro->resume();
-
- XBT_OUT();
-}
-
int SIMIX_process_get_maxpid() {
return simix_process_maxpid;
}
return simix_global->process_list.size();
}
-int SIMIX_process_get_PID(smx_actor_t self)
-{
- if (self == nullptr)
- return 0;
- else
- return self->pid;
-}
-
void* SIMIX_process_self_get_data()
{
smx_actor_t self = SIMIX_process_self();
return nullptr;
}
-int SIMIX_process_is_suspended(smx_actor_t process)
-{
- return process->suspended;
-}
-
-xbt_dict_t SIMIX_process_get_properties(smx_actor_t process)
-{
- return process->properties;
-}
-
void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout)
{
if (process->finished) {
sg_host_t host = process->host;
if (host->isOff())
- THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->cname());
+ THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->getCname());
simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
synchro->host = host;
self->properties,
self->auto_restart);
}
- XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->cname());
+ XBT_DEBUG("Process %s@%s is dead", self->cname(), self->host->getCname());
self->context->stop();
}
xbt_abort();
}
-smx_context_t SIMIX_process_get_context(smx_actor_t p) {
- return p->context;
-}
-
-void SIMIX_process_set_context(smx_actor_t p,smx_context_t c) {
- p->context = c;
-}
-
/**
* \brief Returns the list of processes to run.
*/
}
/** @brief Restart a process, starting it again from the beginning. */
smx_actor_t SIMIX_process_restart(smx_actor_t process, smx_actor_t issuer) {
- XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->cname());
+ XBT_DEBUG("Restarting process %s on %s", process->cname(), process->host->getCname());
//retrieve the arguments of the old process
//FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
return actor;
}
-void SIMIX_segment_index_set(smx_actor_t proc, int index){
- proc->segment_index = index;
-}
-
/**
* \ingroup simix_process_management
* \brief Creates and runs a new SIMIX process.