X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f540320e2e4fd4fe5c9cb1bf8a4b1c0a972082e6..905e26b959375a249abcfdf1599f6178fe031f44:/src/simix/smx_process.cpp diff --git a/src/simix/smx_process.cpp b/src/simix/smx_process.cpp index 6c03b4bb63..9d23a075aa 100644 --- a/src/simix/smx_process.cpp +++ b/src/simix/smx_process.cpp @@ -26,9 +26,9 @@ #include "src/mc/mc_replay.h" #include "src/mc/Client.hpp" #include "src/msg/msg_private.h" -#include "src/synchro/SynchroSleep.hpp" -#include "src/synchro/SynchroRaw.hpp" -#include "src/synchro/SynchroIo.hpp" +#include "src/kernel/activity/SynchroSleep.hpp" +#include "src/kernel/activity/SynchroRaw.hpp" +#include "src/kernel/activity/SynchroIo.hpp" #ifdef HAVE_SMPI #include "src/smpi/private.h" @@ -96,7 +96,7 @@ void SIMIX_process_cleanup(smx_process_t process) /* cancel non-blocking communications */ smx_synchro_t synchro = static_cast(xbt_fifo_pop(process->comms)); while (synchro != nullptr) { - simgrid::simix::Comm *comm = static_cast(synchro); + simgrid::kernel::activity::Comm *comm = static_cast(synchro); /* make sure no one will finish the comm after this process is destroyed, * because src_proc or dst_proc would be an invalid pointer */ @@ -273,13 +273,12 @@ smx_process_t SIMIX_process_create( /* Initiliaze data segment to default value */ SIMIX_segment_index_set(process, -1); - if (parent_process != nullptr) { - process->ppid = SIMIX_process_get_PID(parent_process); - /* SMPI process have their own data segment and - each other inherit from their father */ + if (parent_process != nullptr) { + process->ppid = parent_process->pid; + /* SMPI process have their own data segment and each other inherit from their father */ #if HAVE_SMPI - if(smpi_privatize_global_variables){ - if( parent_process->pid != 0){ + if( smpi_privatize_global_variables) { + if (parent_process->pid != 0) { SIMIX_segment_index_set(process, parent_process->segment_index); } else { SIMIX_segment_index_set(process, process->pid - 1); @@ -358,12 +357,11 @@ smx_process_t SIMIX_process_attach( /* Initiliaze data segment to default value */ SIMIX_segment_index_set(process, -1); if (parent_process != nullptr) { - process->ppid = SIMIX_process_get_PID(parent_process); - /* SMPI process have their own data segment and - each other inherit from their father */ + process->ppid = parent_process->pid; + /* SMPI process have their own data segment and each other inherit from their father */ #if HAVE_SMPI - if(smpi_privatize_global_variables){ - if(parent_process->pid != 0){ + if (smpi_privatize_global_variables) { + if (parent_process->pid != 0) { SIMIX_segment_index_set(process, parent_process->segment_index); } else { SIMIX_segment_index_set(process, process->pid - 1); @@ -467,11 +465,11 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) { /* destroy the blocking synchro if any */ if (process->waiting_synchro) { - simgrid::simix::Exec *exec = dynamic_cast(process->waiting_synchro); - simgrid::simix::Comm *comm = dynamic_cast(process->waiting_synchro); - simgrid::simix::Sleep *sleep = dynamic_cast(process->waiting_synchro); - simgrid::simix::Raw *raw = dynamic_cast(process->waiting_synchro); - simgrid::simix::Io *io = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Exec *exec = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Comm *comm = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Sleep *sleep = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Raw *raw = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Io *io = dynamic_cast(process->waiting_synchro); if (exec != nullptr) { exec->unref(); @@ -530,18 +528,18 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con /* cancel the blocking synchro if any */ if (process->waiting_synchro) { - simgrid::simix::Exec *exec = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Exec *exec = dynamic_cast(process->waiting_synchro); if (exec != nullptr) { SIMIX_execution_cancel(process->waiting_synchro); } - simgrid::simix::Comm *comm = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Comm *comm = dynamic_cast(process->waiting_synchro); if (comm != nullptr) { xbt_fifo_remove(process->comms, comm); comm->cancel(); } - simgrid::simix::Sleep *sleep = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Sleep *sleep = dynamic_cast(process->waiting_synchro); if (sleep != nullptr) { SIMIX_process_sleep_destroy(process->waiting_synchro); if (!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) { @@ -550,12 +548,12 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con } } - simgrid::simix::Raw *raw = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Raw *raw = dynamic_cast(process->waiting_synchro); if (raw != nullptr) { SIMIX_synchro_stop_waiting(process, &process->simcall); } - simgrid::simix::Io *io = dynamic_cast(process->waiting_synchro); + simgrid::kernel::activity::Io *io = dynamic_cast(process->waiting_synchro); if (io != nullptr) { SIMIX_io_destroy(process->waiting_synchro); } @@ -676,20 +674,14 @@ int SIMIX_process_count() return xbt_swag_size(simix_global->process_list); } -int SIMIX_process_get_PID(smx_process_t self){ +int SIMIX_process_get_PID(smx_process_t self) +{ if (self == nullptr) return 0; else return self->pid; } -int SIMIX_process_get_PPID(smx_process_t self){ - if (self == nullptr) - return 0; - else - return self->ppid; -} - void* SIMIX_process_self_get_data() { smx_process_t self = SIMIX_process_self(); @@ -717,11 +709,6 @@ void SIMIX_process_set_data(smx_process_t process, void *data) process->data = data; } -sg_host_t SIMIX_process_get_host(smx_process_t process) -{ - return process->host; -} - /* needs to be public and without simcall because it is called by exceptions and logging events */ const char* SIMIX_process_self_get_name() { @@ -730,11 +717,6 @@ const char* SIMIX_process_self_get_name() { if (process == nullptr || process == simix_global->maestro_process) return "maestro"; - return SIMIX_process_get_name(process); -} - -const char* SIMIX_process_get_name(smx_process_t process) -{ return process->name.c_str(); } @@ -772,7 +754,7 @@ void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, } static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synchro_t synchro){ - simgrid::simix::Sleep *sleep = static_cast(synchro); + simgrid::kernel::activity::Sleep *sleep = static_cast(synchro); if (sleep->surf_sleep) { sleep->surf_sleep->cancel(); @@ -800,7 +782,7 @@ static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synch smx_synchro_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout) { smx_synchro_t res = SIMIX_process_sleep(issuer, timeout); - static_cast(res)->ref(); + static_cast(res)->ref(); SIMIX_process_on_exit(process, (int_f_pvoid_pvoid_t)SIMIX_process_join_finish, res); return res; } @@ -826,7 +808,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration) if (host->isOff()) THROWF(host_error, 0, "Host %s failed, you cannot call this function", sg_host_get_name(host)); - simgrid::simix::Sleep *synchro = new simgrid::simix::Sleep(); + simgrid::kernel::activity::Sleep *synchro = new simgrid::kernel::activity::Sleep(); synchro->host = host; synchro->surf_sleep = surf_host_sleep(host, duration); synchro->surf_sleep->setData(synchro); @@ -838,7 +820,7 @@ smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration) void SIMIX_process_sleep_destroy(smx_synchro_t synchro) { XBT_DEBUG("Destroy synchro %p", synchro); - simgrid::simix::Sleep *sleep = static_cast(synchro); + simgrid::kernel::activity::Sleep *sleep = static_cast(synchro); if (sleep->surf_sleep) { sleep->surf_sleep->unref();